PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 10:08 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu May 10, 2012 1:39 am 
Offline

Joined: Thu May 10, 2012 1:09 am
Posts: 4
Location: Quebec, Canada
Hi,

I need to draw an horizontal 2d bar in a table cell with MigraDoc 1.32.
I didn't find the proper way to draw an horizontal bar so i've cheated and i've created a 2d bar with a width of 100 points and a height of 9 points.
Is there another way to draw an horizontal bar ? also I didn't find a way to put a border around my 2d bar, How can i do that ?

Here is what i've done so far :
Code:
Table table = doc.LastSection.LastTable;
Chart chart = table.Rows[1].Cells[2].AddChart(MigraDoc.DocumentObjectModel.Shapes.Charts.ChartType.Bar2D);
chart.Width = Unit.FromPoint(100);
chart.Height = Unit.FromPoint(9);
chart.FillFormat.Color = Colors.MediumSeaGreen;


thank you in advance for your help :)


Top
 Profile  
Reply with quote  
PostPosted: Thu May 10, 2012 7:45 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!

Use "chart.LineFormat." to set a border.

What are you trying to achieve? A horizontal bar (a ruler)?
Could be achieved with the borders of table cells or with an Image.
But I'm afraid I don't understand what you want.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu May 10, 2012 11:39 am 
Offline

Joined: Thu May 10, 2012 1:09 am
Posts: 4
Location: Quebec, Canada
Hi,

What i'm trying to do is drawing a progress bar (as you can see on the screen capture).
What i was looking for was an orientation property that i can use to display my 2D bar horizontally rather than vertically.

Thank you


Attachments:
copie.png
copie.png [ 9.3 KiB | Viewed 5754 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu May 10, 2012 2:55 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Bars are always horizontal, Columns are always vertical.
Therefore Bar2D should give horizontal bars like you have on your screen shot.

In your code snippet, you're using an empty chart with a green background colour.
You do not add any data to the chart, so no bars will be drawn.

See the Hello MigraDoc sample for a column sample.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 117 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group