This is a migrated thread and some comments may be shown as answers.

IllegalArgumentException when trying to set annotation line outside of data range

10 Answers 45 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 09 Jul 2014, 05:43 AM
Hi,

I'm making an application that displays financial charts for stocks.

As part of the chart I will need to display a annotation line indicating the 'prev close' price.  Sometimes this value will be outside the range of values for the day.  For example the prev close might be 50.00 and the day's range might be 60-70 (due to pre/after market changes prior to the market opening).

On the windows phone chart controls I was able to set the annotation value to outside the data range, and the chart would expand automatically.  On the android chart controls I am getting this error:

java.lang.IllegalArgumentException: the value: 17022.09 is outside the range of the current axis. Current range is: 16820.0 to 16980.0

The issue is that the prev close is not within the range of today's price range, which is normal.  Could you confirm that this is a bug with the charting controls for Android?

Thanks,
Mike

10 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 09 Jul 2014, 05:51 AM
Ok I resolved the issue - I can call rightVAxis.setMaximum(double) to increase the range
0
Victor
Telerik team
answered on 09 Jul 2014, 07:31 AM
Hello Mike,

It's great that you found an easy work around. We will revise this behavior for the next release. It is indeed more convenient if the chart could just expand its value range to accommodate the annotation.

Please write again if you have more feedback you'd like to share.

Regards,
Victor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mike
Top achievements
Rank 1
answered on 09 Jul 2014, 09:57 AM
I ran into an issue with the annotated line after adding in pan & zoom behavior as follows:

ChartPanAndZoomBehavior panZoom = new ChartPanAndZoomBehavior();
        panZoom.setPanMode(ChartPanZoomMode.BOTH);
        panZoom.setZoomMode(ChartPanZoomMode.BOTH);
        _chart.getBehaviors().add(panZoom);

The issue is that when zooming, the annotated line moves/scales correctly.  But after you zoom in and then pan around, the annotated line doesn't follow the pan behavior (so it stays stuck at the same vertical position on the screen).  Let me know if you need more info.
0
Mike
Top achievements
Rank 1
answered on 09 Jul 2014, 09:58 AM
The annotated line was added as follows:

CartesianGridLineAnnotation annotation = new CartesianGridLineAnnotation(this, rightVAxis, open.floatValue());
            annotation.setStrokeEffect(new DashPathEffect(new float[] {2, 2}, 0));
            annotation.setStrokeColor(Color.RED);
            annotation.setStrokeWidth(1);
            _chart.getAnnotations().add(annotation);
0
Accepted
Victor
Telerik team
answered on 09 Jul 2014, 10:14 AM
Hello Mike,

Thanks for writing again. We are aware of the line rendering issue while panning and it has been fixed. The bug fix will be available in our next internal build or official release. If you need this fixed asap we can release a build for you to try.

Please write again if you need further assistance.

Regards,
Victor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mike
Top achievements
Rank 1
answered on 09 Jul 2014, 10:31 AM
If possible, a private build would be great
0
Mike
Top achievements
Rank 1
answered on 09 Jul 2014, 11:44 PM
Thanks,

On another note, is there any way to clear/reset the minimum and maximum of an axis once setMinimum and setMaximum have been called?  The only way I can seem to find right now is to remove the axis and re-create it again.
0
Accepted
Victor
Telerik team
answered on 10 Jul 2014, 07:24 AM
Hello Mike,

Yes, you simply have to set the maximum and minimum to Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY respectively. These are the default values. That is, if you are referring to LinearAxis or LogarithmicAxis.

Regards,
Victor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alex
Top achievements
Rank 1
answered on 08 Sep 2014, 06:00 PM
I'm having the same issue...

"java.lang.IllegalArgumentException: the value: 14.0 is outside the range of the current axis. Current range is: 52.0 to 61.0"

Any pointers as to solving this issue, other than iterating through the data and figuring out the max/min ?
0
Victor
Telerik team
answered on 09 Sep 2014, 07:49 AM
Hello Alex,

Thanks for writing.
We have revised the annotations behavior and now you can set values outside the axis range. If the value range of the axis increases for some reason, the annotation will be rendered in its place.

The new behavior will be available in the next release which is due in October.
Please write again if you have other questions.

Regards,
Victor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Victor
Telerik team
Alex
Top achievements
Rank 1
Share this question
or