3 Answers, 1 is accepted
Most of the changes in the annotation's values should be reflected automatically, however if you have custom values, you may need to call the annotation's requestRender() method to force new rendering of the annotation.
Let us know if you need further assistance.
Regards,
Todor
Telerik
annotations.add(new CartesianCustomAnnotation(verticalAxis, horizontalAxis, 1750.00, "Nov 26", new Annotation(1, 250.00, new Date((long) 1442030400000.0), R.drawable.billgreen, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, 1450.00, "Nov 29", new Annotation(2,150.00, new Date((long)1442030400000.0), R.drawable.billgreen, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, 2950.00, "Dec 1", new Annotation(3, 1500.00, new Date((long)1442030400000.0), R.drawable.money, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, 2835.00, "Dec 4", new Annotation(4, 115.00, new Date((long)1442030400000.0), R.drawable.billorange, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, 2608.00, "Dec 8", new Annotation(5, 227.00, new Date((long)1442030400000.0), R.drawable.billmultiple, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, 1482.00, "Dec 14", new Annotation(6, 69.00, new Date((long)1442030400000.0), R.drawable.billgreen, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, -500.00, "Dec 15", new Annotation(7, 1057.00, new Date((long)1442030400000.0), R.drawable.piggybank, 100, 100)));
annotations.add(new CartesianCustomAnnotation( verticalAxis, horizontalAxis, 2982.00, "Dec 17", new Annotation(8, 1500.00, new Date((long)1442030400000.0), R.drawable.money, 100, 100)));
This is my data.
When I call inside a forloop
annotations.get(i).setHorizontalValue("Dec 1");
annotations.get(i).requestRender();
I get no change in the annotation positions.
From the provided information I don't understand if you can't update the annotations or can't display them at all. The CartesianCustomAnnotation only draws the toString value of the provided Object (in your case Annotation). If you need more control over the drawn content, you can extend the class and override its render method as shown in our online documentation. It also important to note that the annotations should be added to the annotations collection of the chart:
CartesianCustomAnnotation annotation =
new
CartesianCustomAnnotation(verticalAxis, horizontalAxis, 6,
"Feb"
,
"TARGET"
);
chartView.getAnnotations().add(annotation);
Also make sure that the updated value is the same as the value of the axis. In other words since you are providing string values for the horizontal axis, you data should also contain string values for the categories.
I hope this information helps.
Regards,
Todor
Telerik