toxabond / achartengine

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

[Feature request] Chart Values Color in LineChart (but also the other charts) #346

Closed GoogleCodeExporter closed 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?

Values sitting over the points (or inside) with a different color than the 
color of the curve.

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.

When the curve jumps up and down it sometimes covers the values, so that they 
can't be read. It would be nicer if you could away read them, because:
1 - they are drawn AFTER the curve (so, they stay over it, not under).
2 - they have a different color, which can be choosen to be well readable 
against the background color/s and even against the curve's color.

Thank you.

Original issue reported on code.google.com by luca.cri...@gmail.com on 8 Sep 2013 at 5:15

GoogleCodeExporter commented 9 years ago
Well, this is another 5 minutes mod, isn't it?

Original comment by luca.cri...@gmail.com on 8 Sep 2013 at 5:17

GoogleCodeExporter commented 9 years ago
My own fix:

Assign an independent color to curve values (so that you can have text values
drawn in another color)

In

XYChart.java/drawChartValues()
BarChart.java/drawChartValues()
RangeBarChart.java/drawChartValues()

I added this block aty the beginning:

        final Paint pntValues = paint;
        if (XYSeriesRenderer.getChartValuesTextColor() != DefaultRenderer.NO_COLOR)
        {
            pntValues.setColor(XYSeriesRenderer.getChartValuesTextColor());
        }

And replaced all occurences of paint with pntValues

Then, in

XYSeriesRenderer.java

I added this field at the beginning, in declarations:

    /** The chart values text color. */
    /** Special color to use as NULL **/
    private static int mChartValuesTextColor = DefaultRenderer.NO_COLOR;

And I added its getter e setter:

    /**
     * Returns the value text color.
     * 
     * @return the value text color
     */
    public static int getChartValuesTextColor()
    {
        return mChartValuesTextColor;
    }

    /**
     * Sets the value text color
     * 
     * @param color the value text color
     */
    public void setChartValuesTextColor(int color)
    {
        mChartValuesTextColor = color;
    }

That's it

Original comment by luca.cri...@gmail.com on 1 Oct 2013 at 12:51

GoogleCodeExporter commented 9 years ago

Original comment by dandrome...@gmail.com on 31 Oct 2013 at 8:46