Android - Custom Drawing.
Posted: Thu Sep 04, 2014 11:27 am
Hello.
I need help with custom chart drawing. What I have now: Bars show count of sold goods and red triangle shows target count. Code looks like this:
As you can see target equals 300, but on the chart it near 1000. Seems point.x is not value showed on X axis. But what is correct way to calculate the triangle position?
Also Y coordinate of triangle base is not correct to. How to put it exactly on X axis?
Thank you and best regards.
I need help with custom chart drawing. What I have now: Bars show count of sold goods and red triangle shows target count. Code looks like this:
Code: Select all
chart.addChartPaintListener(new ChartPaintAdapter() {
@Override
public void chartPainted(ChartDrawEvent chartDrawEvent) {
final int target = 300;
IGraphics3D graphics = holder.chart.getGraphics3D();
graphics.getPen().setColor(Color.black);
graphics.getBrush().setColor(Color.red);
Point point0 = new Point(target+10, graphics.getYCenter()*2);
Point point1 = new Point(target-10, graphics.getYCenter()*2);
Point point2 = new Point(target, graphics.getYCenter()*2 - 20);
graphics.triangle(point0, point1, point2, 0);
}
});
Also Y coordinate of triangle base is not correct to. How to put it exactly on X axis?
Thank you and best regards.