ibrahimsaputra / achartengine

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

Line Graph x-axis labels mix numbers with text #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a line graph with 3 lines, the y-axis is a number and the x-axis 
consists of months - when I use 'addTextLabel' to my XYMultipleSeriesRenderer I 
seem to get both the text and a number for the x-axis label. The numbers show 
like 2, 4, 6, 8 etc..

I would expect to just see the text without the numbers.

This is the code I'm using to build the display for the graph where the 
labelTitles is a list of the months (there is a swipe that moves the time 
period so I build it dynamically):

    protected void describeXYAxis(XYMultipleSeriesRenderer renderer, String title, String xTitle, String yTitle, String[] labelTitles, double maxY, boolean showLegend) {
        renderer.setXTitle(xTitle);
        renderer.setYTitle(yTitle);
        renderer.setChartTitle(title);
        renderer.setChartValuesTextSize(16);
        renderer.setLabelsTextSize(16);
        //renderer.setBackgroundColor(Color.WHITE);
        renderer.setChartTitleTextSize(22);
        renderer.setAxisTitleTextSize(16);
        renderer.setLegendTextSize(16);
        //renderer.setXAxisMin(1);
        //renderer.setXAxisMax(kMonths);
        renderer.setYAxisMin(0);
        renderer.setYAxisMax(maxY + getYMaxPad());
        renderer.setAxesColor(Color.WHITE);
        renderer.setLabelsColor(Color.WHITE);
        for (int i = 0; i < labelTitles.length; i++) {
            renderer.addTextLabel(i + 1, labelTitles[i]);
        }
        renderer.setShowLegend(showLegend);
        renderer.setShowLabels(true);
        renderer.setShowAxes(true);
        renderer.setShowGrid(false);
        renderer.setDisplayChartValues(true);       
    }

I'm using version 0.6 - the latest.

I'm sure I'm just not configuring this correctly but based on the samples this 
seemed like the right strategy. I think it might happen on the bar graph as 
well but it is hard to see with the 0.6 release in the emulator (it was at 
least happening in the 0.5 release)

Original issue reported on code.google.com by jfbraml...@gmail.com on 19 Mar 2011 at 9:59

GoogleCodeExporter commented 9 years ago
renderer.setXLabels(0); will disable the numbers and show only the text you 
assigned

Original comment by xenocida on 22 Mar 2011 at 4:04

GoogleCodeExporter commented 9 years ago
renderer.setXLabels(0) indeed.

Original comment by dandrome...@gmail.com on 13 Apr 2011 at 5:04

GoogleCodeExporter commented 9 years ago
But this disables the grid. I need the grid but I dont need the values below 
the grid lines. Only the x axis labels should be displayed

Original comment by jess...@gmail.com on 28 Apr 2011 at 6:49

GoogleCodeExporter commented 9 years ago
Do you find this answer? i am also looking for it?

Original comment by ahsanmaq...@gmail.com on 30 Apr 2015 at 7:38