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

Chart Zoom

6 Answers 91 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Reza
Top achievements
Rank 1
Reza asked on 13 Jun 2014, 10:56 AM
Hello There!

I am trying to make a bar chart zoom able!
I've added the behavior to the view and I can zoom it now!
but as I have so many Items in the chart and they may be too much to add them in one view, I tried to make it scrollable but in an unusual way!
At first , I make the view zoomed for a particular amount and I show the chart with that zoom!
I've searched and I saw that there is a function named """setMaxiZoom(RadSize value)""" , but there wasn't any function as """ setMinZoom(RadSize value)""" , So what should I do to make the zoom be more than a particular amount?
Cause if the user decreases the zoom , Values for chart will somehow merge and they will be unreadable and doesn't look good!

Is there any way to change the minzoom?
Maybe to have an if statement that checks the value of zoom and if it was less than a particular value , I change it with the function """ setZoom(RadSize newZoom)"""

And thank you for your amazing library...

6 Answers, 1 is accepted

Sort by
0
Reza
Top achievements
Rank 1
answered on 13 Jun 2014, 11:01 AM
I attached to screen shots from what i mean!
The first one is what It is at firs and the second one is what will happen if the user decreases the zoom value! And I don't want it to happen!
0
Antony Jekov
Telerik team
answered on 13 Jun 2014, 11:20 AM
Hello Reza,

I see what you mean from your screenshots.

Allow me to suggest an alternative option to the min zoom. Have you tried to set the ticks of the chart to rotate, or to arrange on multiple lines? It might suit your needs better than a ScrollView or a min zoom.

Try to set horizontalAxis.setLabelFitMode(AxisLabelFitMode.MULTI_LINE) or  â€‹horizontalAxis.setLabelFitMode(AxisLabelFitMode.ROTATE);

I believe this would be better for your particular case.
If you however disagree with that solution, please let me know, so I can come up with an option involving the min zoom of the chart.

Thank you for contacting us and happy coding,
Antony Jekov
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
Reza
Top achievements
Rank 1
answered on 13 Jun 2014, 11:36 AM
Thank You for your answer
It was really good and useful , and surely i will use it in my chart!

But as the number of the bars in the bar char are not finite I mean there may be 100 bars and it that situation , I cannot do anything except zoom!
And zooming is an unusual way of scrolling , cause it was better than the android scroll view!

Is it possible to do what I am thinking of?
0
Accepted
Antony Jekov
Telerik team
answered on 18 Jun 2014, 11:35 AM
Hi Reza,

In this case I would still recommend a different approach. You can use horizontalAxis.setMajorTickInterval(someInteger); For example, create a chart with 100 bars and see how many labels look good for you, then every time you add a new bar update the ticks interval. This is used in many scenarios, for example the rulers. You don't need to have every step labeled, but you get 1, 5, 10...
I recommend you do this over messing with the zoom, since the user will feel weird in my opinion, if you restrict him from using the full range of the zoom.

If you however don't agree with my approach, then you can extend the chart and override the setZoom(), where you can check the passed value and chose whether to apply it or not.

Thank you for using the Telerik support and for choosing our controls!

Regards,
Antony Jekov
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
Reza
Top achievements
Rank 1
answered on 18 Jun 2014, 01:03 PM
Well thank you for your help! They where really useful!

I did what I wanted by adding a timer task and checking the value of zoom every 10 Milliseconds and if the value was less than what i excepted , i will change it!
Yes, IT IS some how unusual, but it works for what I build the app!

I have a question , Is it possible to change the view of legends in bar chart?
I made a stack bar chart with 3 bar series , I added a radlegendview and it showed them horizontally! but i want them to be shown vertically!
Is it possible by changing a value in radlegendview or I should do it in my way??
0
Antony Jekov
Telerik team
answered on 19 Jun 2014, 03:12 PM
Hi Reza,

I feel like you don't have much confidence in what the Android framework can or cannot do in the first place. All controls we are currently developing are only extending this network, so I feel like you will benefit much more from them, by first getting familiar with the Android framework basics.

I would recommend you to look at the official documentation available here - Android Developers Docs.
It will prepare you to start thinking the Android way and you will have much more confidence using the platform, and far less struggles.

The approach of checking something every 10 milliseconds , in my opinion, should not be used in any scenario. It is far better to simply override the setZoom() method of the chart and apply your validation logic there. It will only be triggered when needed and it will not do any futile work on your thread.

Also, the RadLegendView is a View, and you don't need to ask yourself, can I rotate the RadLegendView, but rather, can I rotate a View in Android. Here is an article on the subject that might prove useful - How to Rotate View in Android 90 degrees. There are many articles on the subject in the net, so I feel you will be fine with this one.

Thank you for using Telerik support and happy coding!

Regards,
Antony Jekov
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
General Discussion
Asked by
Reza
Top achievements
Rank 1
Answers by
Reza
Top achievements
Rank 1
Antony Jekov
Telerik team
Share this question
or