Hello,
Is it possible to show a bar chart like in attached image?
Regards
Shibu
Indus Systems
Stacked Bar Chart in android
-
- Newbie
- Posts: 9
- Joined: Wed Nov 09, 2011 12:00 am
Stacked Bar Chart in android
- Attachments
-
- chart.png (5.65 KiB) Viewed 12342 times
Re: Stacked Bar Chart in android
Hi Shibu,
The following code draws a chart very similar to the chart in your picture for me here.
There was actually a problem with the marks when they are set to be drawn in the center for stacked bars (TJ71015973). I've just fixed it for the next versions.
The following code draws a chart very similar to the chart in your picture for me here.
There was actually a problem with the marks when they are set to be drawn in the center for stacked bars (TJ71015973). I've just fixed it for the next versions.
Code: Select all
tChart1.getAspect().setView3D(false);
tChart1.getPanel().setColor(Color.black);
tChart1.getWalls().setVisible(false);
tChart1.getAxes().getLeft().getLabels().getFont().setColor(Color.white);
tChart1.getAxes().getBottom().getLabels().getFont().setColor(Color.white);
tChart1.getHeader().getFont().setColor(Color.white);
tChart1.getHeader().getFont().setSize(15);
tChart1.getHeader().setText("Dallas | Building 1 | Floor 1");
tChart1.getHeader().setAlignment(StringAlignment.NEAR);
tChart1.getLegend().setAlignment(LegendAlignment.BOTTOM);
tChart1.getLegend().getFont().setColor(Color.white);
tChart1.getLegend().setTransparent(true);
tChart1.getAxes().getLeft().setIncrement(50);
tChart1.getAxes().getLeft().setMinMax(0, 350);
tChart1.getAxes().getBottom().getGrid().setVisible(false);
for (int i=0; i<2; i++) {
Bar bar = new Bar(tChart1.getChart());
bar.setMultiBar(MultiBars.STACKED);
bar.setMarksOnBar(true);
bar.setMarksLocation(MarksLocation.Center);
bar.getMarks().setStyle(MarksStyle.VALUE);
bar.getMarks().setTransparent(true);
bar.getMarks().getFont().setColor(Color.white);
bar.getMarks().getFont().setSize(13);
}
Bar bar1 = (Bar)(tChart1.getSeries(0));
bar1.setTitle("Occupied");
bar1.add(250, "Administration");
bar1.add(145, "Human Resource");
bar1.add(60, "Finance");
bar1.add(275, "Support");
Bar bar2 = (Bar)(tChart1.getSeries(1));
bar2.setTitle("Vacant");
bar2.setColor(Color.fromArgb(220,80,80));
bar2.add(50);
bar2.add(10);
bar2.add(20);
bar2.add(25);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 9
- Joined: Wed Nov 09, 2011 12:00 am
Re: Stacked Bar Chart in android
Hello, Yeray Alonso
Thank you for your support
Shibu
Indus Systems Inc
Thank you for your support
Shibu
Indus Systems Inc