|
chart for percentile |
Posted by Massimo on Jul-04-2016 18:59 |
|
Hi,
i need to display a chart like the attached screenshot taken from an excel file that display 5 different percentiles and an upper and lower target.
I found a multiple layer example from the online documentation and and I think I know how to set the targets; what I cannot figure it out are the different layers background colours.
thanks
|
Re: chart for percentile |
Posted by Massimo on Jul-04-2016 19:19 |
|
forgot to say that the percentile o.50 is the median therefore should also have an highlighted line; I was thinking to have a border in bold or something similar |
Re: chart for percentile |
Posted by Massimo on Jul-05-2016 00:46 |
|
Thanks Peter,
very helpful!!
Tomorrow I'll give it a try |
Re: chart for percentile |
Posted by Peter Kwan on Jul-05-2016 00:42 |
|
Hi Massimo,
First, draw 5 lines for the 50th, 10th, 25th, 75th, 90th percentile in that order. So it is like:
LineLayer line50 = c.addLineLayer(......);
LineLayer line10 = c.addLineLayer(......);
LineLayer line25 = c.addLineLayer(......);
.....
You can configure the line50 to be white in color and 2 pixels thick, the line25 and line75 to be light blue in color, and the line10 and line90 to be light grey in color.
Then add two InterlineLayers to fill the region between line25 and line75, and also the region between line10 and line90.
c.addInterLinelayer(line25.getLine(), line75.getLine(), 0xaaccff, 0xaaccff);
c.addInterLinelayer(line10.getLine(), line90.getLine(), 0xdddddd, 0xdddddd);
Hope this can help.
Regards
Peter Kwan |
Re: chart for percentile |
Posted by Massimo on Jul-05-2016 21:39 |
|
Hi Peter,
my first attempt has not be quite successful
I have attached a screenshot and a txt file with the code I am using. DO not worry about labels as at the moment I am only concentrating in getting the data with the background working.
|
Re: chart for percentile |
Posted by Peter Kwan on Jul-05-2016 22:28 |
|
Hi Massimo,
The following lines are incorrect:
Line90 = c.addLineLayer(data0, 0x93979A,"",0); //light grey
Line10 = c.addLineLayer(data0, 0x93979A, "", 0); //light grey
Line25 = c.addLineLayer(data0, 0x2891F0, "", 0); //light blue
Line75 = c.addLineLayer(data0, 0x2891F0, "", 0); //light blue
Line50 = c.addLineLayer(data0, 0xffffff, "", 0); //white for median
They should use data0, data1, data2, data3, data4. (Your code uses the same data0 for all lines.)
If the above is correct, the addDataSet lines are not necessary.
Regards
Peter Kwan |
Re: chart for percentile |
Posted by Massimo on Jul-05-2016 23:27 |
|
apologies for wasting your time Peter, that was really silly from me!! |
Re: chart for percentile |
Posted by Massimo on Jul-06-2016 17:28 |
|
Hi Peter,
if you see the image I got the shade of blue but for the interline between the 25 and 75 percentile , the grey background 0xdddddd does not show up. Do you think is because of the colour being too light or because is rendered in the background? Below the code I am using now.
c.addInterLineLayer(Line10.getLine(), Line90.getLine(), 0xaaccff, 0xaaccff);
c.addInterLineLayer(Line25.getLine(), Line75.getLine(), 0xdddddd, 0xdddddd);
|
Re: chart for percentile |
Posted by Peter Kwan on Jul-06-2016 21:28 |
|
Hi Massimo,
The ordering should be:
c.addInterLineLayer(Line25.getLine(), Line75.getLine(), 0xdddddd, 0xdddddd);
c.addInterLineLayer(Line10.getLine(), Line90.getLine(), 0xaaccff, 0xaaccff);
If you reverse the ordering, the 10 - 90 shading will cover up the 25 - 75 shading, so that latter will not be visible.
Hope this can help.
Regards
Peter Kwan |
Re: chart for percentile |
Posted by Massimo on Jul-06-2016 22:26 |
|
yep,
that did the trick; hopefully I will not be asked to have a third area between 50 and 75.
|
Re: chart for percentile |
Posted by Peter Kwan on Jul-06-2016 23:44 |
|
Hi Massimo,
In case you are asked to have some other filled region, each region only requires one additional addInterLineLayer. You only need to ensure they are in the correct order if they overlap.
Actually for your current case, there is another filling method which is non-overlapping and so can be added in any order. You can use 3 addInterLineLayer - between Line10 and Line25 (light blue), between Line25 and Line75 (deeper blue), and between Line75 and Line90 (light blue).
Regards
Peter Kwan |
Re: chart for percentile |
Posted by Massimo on Jul-10-2016 03:31 |
|
Thanks
that worked perfectly; Peter there is any properties for the lines to be more smooth rather that the way are rendered now? |
Re: chart for percentile |
Posted by Massimo on Jul-10-2016 03:40 |
|
Should I use splinelayer? |
Re: chart for percentile |
Posted by Peter Kwan on Jul-12-2016 02:10 |
|
Hi Massimo,
The line style in the ChartDirector chart is the same as the line style in your original chart, that is, the entire line consists of straight line segments.
You can use spline layer instead of line layer, but then the line will be quite smooth, must smoother than your original chart.
If you think your original chart is somewhat smooth, it may be due to several factors:
(a) The colors in your original chart is very pale
(b) The border of the filled region is using an even paler color. In ChartDirector you can even use a semi-transparent color for the border.
Regards
Peter Kwan |
Re: chart for percentile |
Posted by Massimo on Jul-12-2016 03:33 |
|
Sorry Peter,
I have not explained myself vey well; I want my chart lines to be smoother and this is why I thought to use the spline layer |
Re: chart for percentile |
Posted by Peter Kwan on Jul-12-2016 23:45 |
|
Hi Massimo,
In this case, you can try to replace addLineLayer with addSplineLayer to see if the chart if what you would like.
Regards
Peter Kwan |
Re: chart for percentile |
Posted by Massimo on Jul-12-2016 23:52 |
|
Thanks Peter,
I am using it and this is the final format.
As always your help is outstanding.
|
|