Stacked BarChar - change one serie to Line [message #956292] |
Wed, 24 October 2012 07:44  |
Eclipse User |
|
|
|
I need to use stacked bar chart, where series are generated dynamically
by grouping. One of series (identified by name) should be displayed as
line. How to do it?
I found only switching stack/unstack or visibility in beforeDrawSeries:
var seriesID = series.getSeriesIdentifier();
if (seriesID == "total") {
series.setStacked(false); <<
}
regards
Jaroslav
|
|
|
|
Re: Stacked BarChar - change one serie to Line [message #958386 is a reply to message #958180] |
Thu, 25 October 2012 20:38   |
Eclipse User |
|
|
|
Looks like you might be able to get this to happen, in the beforeGeneration script. With the stacked bar with optional grouping, I wasn't able to create my own lineSeries and put it in there, in some quick testing. I was able to create a hidden line series and steal one line from the hidden series definition and put it in the stacked bar visible series definition, however, it had to be a stacked series, which might not work for you.
Edit:
If you create a second identical series, in your chart only make it a line chart and unstack it. You can simply step through your series and hide the stacked bar and then step through the next series and hide all lines except the one you want to show, with a script like this:
function beforeGeneration( chart, icsc )
{
xAxis = chart.getAxes().get(0);
yAxis = xAxis.getAssociatedAxes().get(0);
sd1 = yAxis.getSeriesDefinitions().get(0);
sd2 = yAxis.getSeriesDefinitions().get(1);
for(i=0;i<sd1.getSeries().size();i++){
if(sd1.getSeries().get(i).getSeriesIdentifier() == "Series 1"){
sd1.getSeries().get(i).setVisible(true);
}
else if(sd1.getSeries().get(i).getSeriesIdentifier() == "total"){
sd1.getSeries().get(i).setVisible(false);
}
else{
sd1.getSeries().get(i).setVisible(true);
}
}
for(i=0;i<sd2.getSeries().size();i++){
if(sd2.getSeries().get(i).getSeriesIdentifier() == "Series 2"){
sd2.getSeries().get(i).setVisible(true);
}
else if(sd2.getSeries().get(i).getSeriesIdentifier() == "total"){
sd2.getSeries().get(i).setVisible(true);
}
else{
sd2.getSeries().get(i).setVisible(false);
}
}
}
[Updated on: Thu, 25 October 2012 21:28] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28511 seconds