Page 1 of 1

Pie,Line and Bar chart resources

Posted: Thu Jul 23, 2015 1:59 pm
by antrax13
Hi,
could someone give me a link/resources where I can learn about this topic?

I want to construct pie chart with 3 sections 10,20 and 70% and each section would have different color and percentage label.

I want to construct line chart going from [0,0] to [10,10] to [20,15] to [70,30] also x,y label

I want to construct bar chart with 10,20 and 70%. Each bar would have different color and percentage label and also x,y label

I do not want to use another third party engine/tool to create these charts unless its open source.

Thanks

Re: Pie,Line and Bar chart resources

Posted: Thu Jul 23, 2015 3:56 pm
by MaxV
antrax13 wrote:
I want to construct pie chart with 3 sections 10,20 and 70% and each section would have different color and percentage label.
Draw a circle, set start and arc from the property inspector.
antrax13 wrote: I want to construct line chart going from [0,0] to [10,10] to [20,15] to [70,30] also x,y label
Draw a line, set the points to

Code: Select all

0,0
10,10
20,15
70,30
You'll need to change real point values, since the origin inside a window start from the top-left corner.
antrax13 wrote: I want to construct bar chart with 10,20 and 70%. Each bar would have different color and percentage label and also x,y label
Draw 3 different rectangles. Change their colors and rect property.
Otherwise you can crate just one rectangle and play with gradients. :mrgreen:

Re: Pie,Line and Bar chart resources

Posted: Thu Jul 23, 2015 4:25 pm
by antrax13
that was not helpful at all

Re: Pie,Line and Bar chart resources

Posted: Thu Jul 23, 2015 7:14 pm
by Simon
Wow antrax13,
that was not helpful at all
Are you trying not to be helped?
Everything MaxV said was correct. A more positive response would be "I don't understand what you mean, could you explain it a bit more?" or "Where do I find out about arc?".

99% of the posts in these forums are from volunteers, nobody has to help you here.

Simon

Re: Pie,Line and Bar chart resources

Posted: Thu Jul 23, 2015 7:23 pm
by dunbarx
What Simon said.

I suspect, and hope, that the comment was not as abrasive as it seemed. Communication via text must be carefully crafted.

What I think was really meant was: Can I get a code example?

So antrax13, was that it?

Craig Newman

Re: Pie,Line and Bar chart resources

Posted: Mon Jul 27, 2015 9:00 am
by antrax13
What I am looking for is just some sort of examples/code/resources where to read/see how its done for pie, line and bar chart.

To draw line chart it is not so simple as it looks like if you just join points. It will not work if your axis must be flexible you do not want to show for example bar charts with values of 20 and 30 where Y axis is max 100 then its easy what if your values will be 10,10000 in that case you want to have max value of Y axis set to 10000+ but your Y axis will be the same size as 100 so you need to calculate coordinates in that case point [10,10] will not be at the same location where Y is 100 than the same point where Y is 10000. That is something I am looking for.

I will attach image for better illustration.
Image

When I have to produce a bar charts with values 20,30 it will not be the same height on first chart compare to chart 2 where values will be 20,10000

Thats what I need to point me to good direction with good resources or examples

Re: Pie,Line and Bar chart resources

Posted: Mon Jul 27, 2015 4:04 pm
by dunbarx
Hi.

This is not as onerous as you would think. The trick is to adjust each graph according to the situation. So if you make a graph of fixed size, you know its height. Say it is 200 pixels, Now if you want to place a bar that shows, say, 5 out of 10, you would set your vertical scale from 1 to 10, and set the height of the bar to 100. But if you make a new scale that goes from 1 to 1000, the height of the bar does not change; it is still 100. What changes is the scale factor you use in your calculations.

So set up your graph, again perhaps 200 pixels high. Place the text field that will contain your vertical scale. Place your bar graphic. Now only the ratio of the bar value to the max value matters. So if you need 5 out of 10 (pseudo):

Code: Select all

get the ratio--5 / 10 = 0.5
set the height of graphic "barGraphic" to it * 200 -- height is 100
Now if you need 250 out of 1000 (pseudo):

Code: Select all

get the ratio --250 / 1000 = 0.25
set the height of graphic "barGraphic" to it * 200 -- height is 50
Does this do it for you?

Craig

Re: Pie,Line and Bar chart resources

Posted: Tue Jul 28, 2015 8:58 am
by antrax13
Thanks that helps me.

If anyone is interested check my stack