Page 1 of 1

Android Custom Bar Issues

Posted: Wed May 08, 2013 3:24 pm
by 17065563
I am attempting to use the Custom Bar type on Android but am unable to actually get the bars to show. The marks show so I know the data is being presented correctly, but nothing I do seems to be able to make the bars themselves show. If I switch to a standard Bar the data shows fine. I would use the standard bar but it seems like the Custom Bar has some options I will need for my chart. Below is the code I am using to try to setup the chart:

Code: Select all

Chart chart = mTChart.getChart();
			
Axes axes = chart.getAxes();
axes.getBottom().setMaximum( 520 );
axes.getBottom().setAutomatic( false );
axes.getBottom().setLabelsOnAxis( true );
axes.getLeft().setMaximum( 130 );
axes.getLeft().setAutomatic( false );

series = Series.createNewSeries(chart, CustomBar.class, null);		
			
CustomBar cb = (CustomBar)series;
cb.setBarStyle( BarStyle.RECTANGLE );
ChartPen pen = cb.getPen();
	
pen.setWidth( 1 );
pen.setStyle( DashStyle.SOLID );
//pen.setColor(  )
			
series.getMarks().setVisible( true );
cb.setMultiBar( MultiBars.STACKED );
cb.setBarStyle( BarStyle.RECTANGLE );
cb.setColor( Color.RED );
cb.getBrush().setColor( Color.BLUE );
cb.getBrush().setTransparency( 0 );
cb.setVisible( true );

Re: Android Custom Bar Issues

Posted: Thu May 09, 2013 3:38 pm
by yeray
Hello,

CustomBar is the parent of Bar and HorizBar because these two series share most part of the characteristics, but it's not designed to be directly added to a chart.
Jbarrot wrote:I would use the standard bar but it seems like the Custom Bar has some options I will need for my chart
What are those options?
I can change CustomBar for Bar in your code and it seems to work fine for me here.