Menu

#39 Error bars are not displayed correctly in a chart with several bar series

v0.9.0
closed-fixed
nobody
None
5
2016-02-12
2015-09-16
No

I am using swtchart to create a chart with category axis and multiple bar series. In addition, I am setting error bars for each series. The problem I am having is that the error bars are not shown on the bar series but always at the position of the tick at the x-axis (where category labels are). I am attaching the picture of the chart. There are two error bars that are shown on top of each other for most of the series.

Here is the portion of the code where I am adding error bars:

double[][] yAxisValues=new double[dataList[0].length][dataList.length];
double[][] errorValues = new double[dataList[0].length][dataList.length];
i=0;
for (ChartData[] chartDataList : dataList) {
int j=0;
for (ChartData data : chartDataList) {
yAxisValues[j][i] = data.getAverage();
errorValues[j][i] = data.getStDev();
j++;
}
i++;
}
for (int j = 0; j < allSeries.length; j++) {
allSeries[j].setYSeries(yAxisValues[j]);
IErrorBar yErrorBar = allSeries[j].getYErrorBar();
yErrorBar.setType(ErrorBarType.PLUS);
yErrorBar.setPlusErrors(errorValues[j]);
yErrorBar.setVisible(true);
yErrorBar.setLineWidth(2);
}

1 Attachments

Discussion

  • Sena Arpinar

    Sena Arpinar - 2015-09-16

    I have made a simple change in the way pixelcoordinates are calculated for error bar in BarSeries.java to fix this issue. The patch is attached.

     
  • yoshitaka

    yoshitaka - 2016-02-12
    • status: open --> closed-fixed
     
  • yoshitaka

    yoshitaka - 2016-02-12

    fixed in 0.10.0