I have an issue which like to overcome. I’m using the achartengine to draw a bar chart on android application. At the first time, i can set the orientation for the chart by using “rederer.setOrientation(Orientation.VERTICAL)” and it works fine. But what i’d like it when we rotate the device, the chart will change it’s orientation, so the bar in chart will change respectively like this:
- When the device is in state “landscape” the chart will change to “horizontal”
- When the device is in state “portrait” the chart will change to “vertical”
Could anyone tell me how to do that? Thanks for any comments.
Thanks
Clark
You should override your
onConfigurationChange(newConfig)method in yourActivityand when detecting a change, just change the bar chart orientation in the way you mentioned. You may need to callrepaint()on your chart view.Read this for more information on handling orientation changes.