0

I am using core plot library to construct Bar Graph.

My issue is that I want to capture whole bar graph as Image so that user can mail it to their friends.

I searched and found

UIImage *newImage=[pieGraph imageOfLayer];

which actually captures current screen of graph, but as it is bar graph many of Bar in bar graph are going out of screen.

Is there any way to capture complete bar graph.

Thanks in advance.

P.J
  • 6,547
  • 9
  • 44
  • 74

3 Answers3

1

The -imageOfLayer method only captures the current contents of a layer (e.g., the graph) and its sublayers. If you want to make an image of a graph showing more data, you need to make another one that shows the desired data. It doesn't have to be onscreen in a hosting view--just create the graph and plot, give it the desired dimensions, and generate the image.

Eric Skroch
  • 27,381
  • 3
  • 29
  • 36
  • Can you please explain in detail which frame I need to change? I am facing the same issue and its yet unresolved. – Yogi Feb 05 '13 at 05:55
0

How to capture UIView to UIImage without loss of quality on retina display

This should work, depending on how the code display the graph is rendering. Failing that I'd just double check what the uiview in questions rect and bounds actually are to see whether it's doing some 'magic' to render the extra data rather than just keeping it offscreen and using transforms to let you scroll/zoom around. It's very similar to the previous answer but uses view bounds instead.

Community
  • 1
  • 1
Diziet
  • 2,397
  • 1
  • 26
  • 34
-1

Try to capture screenshot. See this for more help

Virat Naithani
  • 783
  • 12
  • 31