Hi.
Using Java for Android v3.2015.0108
I have several Annotations on my chart. When I'm adding ColorLines that correspond to the bottom axis, I have an issue that these ColorLines are drawn on top of the annotations.
Is there any solution how to draw ColorLines behind annotations? I was looking for something like z-order for annotations' shapes and ColorLines but found nothing.
ColorLine is drawn on top of the annotation
Re: ColorLine is drawn on top of the annotation
Hi Dennis,
The order of adding the tools on the chart determines the drawing order.
Adding an Annotation, then adding a ColorLine and then adding a second Annotation gives this:
But you can reorder the tools in the list:
The order of adding the tools on the chart determines the drawing order.
Adding an Annotation, then adding a ColorLine and then adding a second Annotation gives this:
Code: Select all
tChart1.getAspect().setView3D(false);
tChart1.getLegend().setVisible(false);
Points points1 = new Points(tChart1.getChart());
points1.fillSampleValues();
Annotation annot1 = new Annotation(tChart1.getChart());
annot1.setText("This is annotation 1");
annot1.getShape().setCustomPosition(true);
annot1.setLeft(150);
annot1.setTop(100);
ColorLine colorLine1 = new ColorLine(tChart1.getChart());
colorLine1.setAxis(tChart1.getAxes().getBottom());
colorLine1.setValue(10);
Annotation annot2 = new Annotation(tChart1.getChart());
annot2.setText("This is annotation 2");
annot2.getShape().setCustomPosition(true);
annot2.setLeft(150);
annot2.setTop(150);
Code: Select all
//reorder
Tool tmp = tChart1.getTools().getTool(2);
tChart1.getTools().setTool(2, tChart1.getTools().getTool(0));
tChart1.getTools().setTool(0, tmp);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: ColorLine is drawn on top of the annotation
Thank you, Yeray.
I guessed that the order of adding tools can infuence on the result. But the question is that I have to redraw color lines each time when chart painted, and annotations are created only once on startup.
I'm using ColorLine to highlight some grid lines (with a different color and line style). And the grid always changes as the data is loaded to the chart (I have realtime chart). I guess that recreate annotations for every time when data loaded is not the best solution... So probably you can provide any other options how to draw color lines behind the annotation?
I guessed that the order of adding tools can infuence on the result. But the question is that I have to redraw color lines each time when chart painted, and annotations are created only once on startup.
I'm using ColorLine to highlight some grid lines (with a different color and line style). And the grid always changes as the data is loaded to the chart (I have realtime chart). I guess that recreate annotations for every time when data loaded is not the best solution... So probably you can provide any other options how to draw color lines behind the annotation?
Re: ColorLine is drawn on top of the annotation
Hello,
You can also set the ColorLines to be always drawn before the series (and also before the other tools like the Annotation tool) with DrawBehind:
However, I'm not sure if this will fit your requirements.
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the situation here.
You can also set the ColorLines to be always drawn before the series (and also before the other tools like the Annotation tool) with DrawBehind:
Code: Select all
ColorLine colorLine1 = new ColorLine(tChart1.getChart());
colorLine1.setAxis(tChart1.getAxes().getBottom());
colorLine1.setValue(10);
colorLine1.setDrawBehind(true);
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the situation here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |