Android - Bar/ColumnSeries setLineWidth ignored


#1

Hi, I’m having a problem as per the title of the post.

I’m adding a BarSeries to a chart (using a ColumnSeries holds the same result, though), and I’m trying to set the width of the bars (columns).

What I do then, is the following:

DataAdapter<String,Double> da1 =newSimpleDataAdapter<String,Double>();
        da1.add(newDataPoint<String,Double>("q1",1.0));
        da1.add(newDataPoint<String,Double>("q2",3.0));
        da1.add(newDataPoint<String,Double>("q3",4.5));
        da1.add(newDataPoint<String,Double>("q4",-2.5));BarSeries series1 =newBarSeries();
        series1.setDataAdapter(da1);BarSeriesStyle css1 = series1.getStyle();
        css1.setLineWidth(180.0f);
        css1.setAreaColor(Color.YELLOW);CategoryAxis xAxis =newCategoryAxis();
        chart.setXAxis(xAxis);
        xAxis.getStyle().setInterSeriesPadding(0.2f);NumberAxis yAxis =newNumberAxis();
        chart.setYAxis(yAxis);
        yAxis.getStyle().setInterSeriesPadding(0.2f);

        chart.addSeries(series1);

And for the columns:

ColumnSeries cs =newColumnSeries();DataAdapter<Float,Integer> adapterAxis =newSimpleDataAdapter<Float,Integer>();
    adapterAxis.add(newDataPoint<Float,Integer>(0f,3));
    cs.getStyle().setLineColor(Color.BLACK);
    cs.getStyle().setLineWidth(1f);
    cs.setDataAdapter(adapterAxis);

The problem is, no matter what I use as line width, nothing changes, and the bar/column remains the same, with its size set by the library.

(Incidentally, I also posted the question on StackOverflow, if you wanna check it there: http://stackoverflow.com/q/25482560/525843)


#2

Hi stepbeta,

Just to let you know my colleague Kai has updated his answer on StackOverflow - hopefully that’s helped you get to what you’re after!

Kind regards,

Patrick


#3

Hi Patrick,

Thanks for the heads up, I’ll have a look as soon as I can!


#4

Hi Patrick,

Kai’s answer did help, thanks. I opened a new one because of a similar but different scenario I still have problems with. You can find it here: http://stackoverflow.com/questions/25622105/padding-between-bars-when-using-multiple-barseries-in-shinobi

Thanks!


#5

Glad to hear it helped!

We’ll take a proper look at your Stack Overflow post in due course but if you’re trying to simulate one BarSeries with multiple BarSeries (so you can have different coloured bars) you need to set the same stack id on each bar (doesn’t matter what value, just as long as it’s the same).

Kind regards,

Patrick


#6

That did the trick, thanks!