[Help] Some problem relative to BarSeries in Android


Hi all.

I trying use shinobicharts to design like as this chart:


I used BarSeries, and i having a few problem following:

-  i can’t found function to set data on each DataPoint (20, 25, 30).

  • i want set other color for each data point like in the image above. (red, green, purple)

  • right align for label. (France, Malaysia, Spain).

And this code:

     ChartFragment chartFragment = (ChartFragment) getFragmentManager().findFragmentById(R.id.chart);
      ShinobiChart shinobiChart = chartFragment.getShinobiChart();

       NumberAxis xAxis = new NumberAxis();
        CategoryAxis yAxis = new CategoryAxis();
        BarSeries series = new BarSeries();
        DataAdapter<Integer, String> adapter = new SimpleDataAdapter<Integer, String>(); 

         adapter.add(new DataPoint<Integer, String>(20, “Spain”));
         adapter.add(new DataPoint<Integer, String>(25, “Malaysia”));
         adapter.add(new DataPoint<Integer, String>(30, “France”));


Please help me!


help me … :cry:


Hello Sweet_boy,

Thanks for getting in touch.

In order to add data labels to each bar, you need to make use of the AnnotationsManager class (please note that this is a premium feature). You can add simple text annotations using code similar to that below:

shinobiChart.getAnnotationsManager().addTextAnnotation("30", 1, 2, xAxis, yAxis);

Once you have added your annotations to your chart, you can style them using code similar to that below:

for (Annotation annotation : shinobiChart.getAnnotationsManager().getAnnotations()) {

This would style the annotations similar to those shown in your screen shot, that is white with a transparent background. For your reference the api for the AnnotationsManager can be found here:


In order to achieve 3 coloured bars similar to your screen shot, you will need to use 3 bar series, setting the stack id to be equal on each series. Each series would contain a data point for France, Malaysia and Spain, but in each case the x value would be 0 for the other two countries. So for example in the series for France, Spain and Malaysia would have their x values set to 0.

You could then style each series individually by manipulating it’s style object. Some sample code is below:

BarSeries seriesFrance = new BarSeries();
BarSeries seriesMalaysia = new BarSeries();
BarSeries seriesSpain = new BarSeries();

DataAdapter<Integer, String> adapterFrance = new SimpleDataAdapter<Integer, String>();
adapterFrance.add(new DataPoint<Integer, String>(0, "Spain"));
adapterFrance.add(new DataPoint<Integer, String>(0, "Malaysia"));
adapterFrance.add(new DataPoint<Integer, String>(30, "France"));

DataAdapter<Integer, String> adapterMalaysia = new SimpleDataAdapter<Integer, String>();
adapterMalaysia.add(new DataPoint<Integer, String>(0, "Spain"));
adapterMalaysia.add(new DataPoint<Integer, String>(25, "Malaysia"));
adapterMalaysia.add(new DataPoint<Integer, String>(0, "France"));

DataAdapter<Integer, String> adapterSpain = new SimpleDataAdapter<Integer, String>();
adapterSpain.add(new DataPoint<Integer, String>(20, "Spain"));
adapterSpain.add(new DataPoint<Integer, String>(0, "Malaysia"));
adapterSpain.add(new DataPoint<Integer, String>(0, "France"));





So on to your third point regarding the alignment of the tick mark labels. ShinobiCharts for Android currently uses centre alignment as a default and unlike our iOS product, this cannot be changed. We do strive to bring ShinobiCharts for Android into alignment with its more mature iOS stable mate and this feature is thus on our roadmap. While I’m not able to give you a time scale for this at the moment, we do prioritise feature development based on customer demand so I’ll certainly register your interest in it.

I hope that you find this information useful. If you have any further queries, please do not hesitate to get in touch.




Yeah. Thanks for your support.

i using version premium and have done successfully  :laughing: