yunjianwu / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Request for adding image as background to Bar Chart #274

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
Adding image as background 

Please provide a source code snippet that we can use to replicate the issue.

What version of the product binary library are you using?
1.1.0

Please provide any additional information below.
Please provide additional feature of adding background as image to bar chart as 
soon as possible

Original issue reported on code.google.com by varunagp...@gmail.com on 11 Feb 2013 at 6:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
What is the advantage of having this feature?

Original comment by dandrome...@gmail.com on 12 Feb 2013 at 4:30

GoogleCodeExporter commented 9 years ago
we can make the bar chart to have elegant look and feel

Original comment by varunagp...@gmail.com on 12 Feb 2013 at 5:04

GoogleCodeExporter commented 9 years ago
I hacked the library for my project in order to use clipping instead of the 
current method of overdrawing the margins, which allowed me to then use a 
background. However, I'm not really an Android expert, so I was wondering 
whether this would have a performance impact?

Original comment by o...@steamshift.net on 18 Feb 2013 at 3:41

GoogleCodeExporter commented 9 years ago
Turns out the way I was doing it was very slow (I was drawing the graph to a 
clipped bitmap and then drawing that back to the canvas).

However, I came up with another method that is much faster. I've only 
implemented it for the BarChart, since that's all I need at the moment, but in 
this case, I removed the margin drawing code from XYChart.draw, and added this 
to BarChart.drawBar, just before it draws the bar:

if (xMin > bounds.right || xMax < bounds.left || yMin > bounds.bottom || yMax < 
bounds.top) return;
xMin = Math.max(xMin, bounds.left);
xMax = Math.min(xMin, bounds.right);
yMin = Math.max(yMin, bounds.top);
yMax = Math.min(yMin, bounds.bottom);

bounds is passed in from drawSeries, which is passed it by draw, and uses left, 
top, right, bottom as they are calculated in that method.

Original comment by o...@steamshift.net on 19 Feb 2013 at 3:41

GoogleCodeExporter commented 9 years ago
That should be 

if (xMin > bounds.right || xMax < bounds.left || yMin > bounds.bottom || yMax < 
bounds.top) return;
xMin = Math.max(xMin, bounds.left);
xMax = Math.min(xMax, bounds.right);
yMin = Math.max(yMin, bounds.top);
yMax = Math.min(yMax, bounds.bottom);

of course...

Original comment by o...@steamshift.net on 19 Feb 2013 at 4:10

GoogleCodeExporter commented 9 years ago
can't understand your solution,can you give us more detail? i have this request 
for my project too

Original comment by veronica...@gmail.com on 14 Mar 2013 at 7:01

GoogleCodeExporter commented 9 years ago
Support for adding each bar as an image would be very helpful.Please let me 
know incase of any workarounds apart from customizing the library.

Original comment by sundee...@gmail.com on 2 Sep 2013 at 11:10