开发者

How to scale on x-axis with Core Plot

开发者 https://www.devze.com 2023-01-12 03:25 出处:网络
I have a barchart display the smoking counter, day by day. Each column represents one day. I would like to view the data on week, month,

I have a barchart display the smoking counter, day by day. Each column represents one day. I would like to view the data on week, month, year, on the same graph by drag on the X-Axis. If I drag the x-axis to the right, the value on the x-axis come from month to day (smaller value scale). If I drag the x-axis to the left, the value on the x- axis come from day to month (bigger value scale).

I would like to ask: Can I make that functionality?

I am new with Core-Plot. So would you please show me how I can do that, which method, class, delegate I should implement to make that functionality.

Any help will be great appreciated.

开发者_C百科

Thank you.


This question is pretty old, but quite interesting. I see two ways of dealing with it:

  1. Using swipe gestures
    • Detect swipe gestures on the graph view;
    • When one is detected, start a fade out animation to hide the graph;
    • Update it (axis, plot space, reloadData, etc.) to display data in the unit that corresponds to the direction of the swipe gestures;
    • Fade in.
  2. Using a UIScrollView
    • Create a UIScrollView with 3 pages (one fore each unit);
    • Display a different graph on each of these pages;
    • Implement navigation between the pages (eventually using a UIPageControl).
0

精彩评论

暂无评论...
验证码 换一张
取 消