hochileo / achartengine

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

problems with XYMultipleSeriesRenderer vertical orientation #203

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new XYMultipleSeriesRenderer.
2. Set orientation VERTICAL
3. Add few x and y labels

What is the expected output? What do you see instead?
I see 2 problems:
1. Text labels(5, 10, 15, ...) are placed right on Y axis. 
2. All text labels are stretched in accordance to screen orientation.

Please provide a source code snippet that we can use to replicate the issue.
LinearLayout prsChartWrap = (LinearLayout) 
findViewById(R.id.personal_chart_wrap);

        XYMultipleSeriesRenderer render = new XYMultipleSeriesRenderer();

        render.setOrientation(XYMultipleSeriesRenderer.Orientation.VERTICAL);
        render.setMarginsColor(Color.WHITE);
        render.setShowLegend(false);
        render.setLegendHeight(20);
        render.setAntialiasing(true);
        render.setShowLabels(true);
        render.setLabelsTextSize(25);
        render.setYLabelsAlign(Align.LEFT);
        render.setXLabelsAlign(Align.LEFT);
        render.setAxesColor(Color.BLACK);
        render.setLabelsColor(Color.BLACK);
        render.setApplyBackgroundColor(true);
        render.setBackgroundColor(Color.WHITE);
        render.setZoomEnabled(true, false);
        render.setPanEnabled(true, false);
        render.setXAxisMin(-0.3);
        render.setXAxisMax(4);
        render.setAxisTitleTextSize(20);
        render.setMargins(new int[] { 10, 40, 0, 0 });
        render.setBarSpacing(-0.4);
        render.setPanLimits(new double[] { -0.5,
                15, 0, 0 });
        render.setMarginsColor(Color.WHITE);
        render.setZoomEnabled(false, false);
        render.setLabelsColor(Color.RED);

        XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
        XYSeriesRenderer seriesRenderer = new XYSeriesRenderer();
        render.setXLabels(0);
        seriesRenderer.setColor(Color.BLUE);
        seriesRenderer.setLineWidth(500f);
        seriesRenderer.setFillBelowLine(false);

        XYSeries data;

        int i = 0;

        String[][] items = { { "first", "25" }, { "second", "20" },
                { "third", "15" }, { "fourth", "10" }, { "fifth", "5" } };

        for (String[] item : items) {

            data = new XYSeries(item[0]);
            data.add(i, Integer.valueOf(item[1]));
            render.addSeriesRenderer(seriesRenderer);
            render.addXTextLabel(i, "        " + item[0]);
            i++;
            dataset.addSeries(data);

        }

        GraphicalView gView = ChartFactory
                .getBarChartView(this, dataset, render,
                        BarChart.Type.STACKED);
        prsChartWrap.addView(gView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

What version of the product binary library are you using?
achartengine-0.7.0.jar(revision 382 from 
http://achartengine.googlecode.com/svn/trunk/)

Please provide any additional information below.
See attachments from screens and test project.
Thank you.

Original issue reported on code.google.com by pashashm...@gmail.com on 2 Apr 2012 at 4:04

Attachments:

GoogleCodeExporter commented 9 years ago
I have the same issue whit v1.0 :/

Original comment by torti....@gmail.com on 8 May 2012 at 2:48

GoogleCodeExporter commented 9 years ago
Yes. I'm also having the same problem.

Original comment by Adrian.K...@gmail.com on 23 May 2012 at 1:35

GoogleCodeExporter commented 9 years ago
Issue 130 has been merged into this issue.

Original comment by dandrome...@gmail.com on 13 Jun 2012 at 11:43

GoogleCodeExporter commented 9 years ago
I'm having the same problem.
How to Fix it?

Original comment by nixiaod...@gmail.com on 2 Jul 2012 at 5:34

GoogleCodeExporter commented 9 years ago
Issue 231 has been merged into this issue.

Original comment by dandrome...@gmail.com on 11 Jul 2012 at 11:00

GoogleCodeExporter commented 9 years ago
I'm currently facing the same problem, will there be a fix someday?

Original comment by c.roessl...@googlemail.com on 1 Feb 2013 at 10:09

GoogleCodeExporter commented 9 years ago
There may be one. However, the vertical orientation bar chart is an 
experimental feature. When somebody will have time to invest in improving it 
that may be the day.

Original comment by dandrome...@gmail.com on 1 Feb 2013 at 1:14

GoogleCodeExporter commented 9 years ago
Who is somebody? Me? :)
I had a look in the code and saw that the vertical bar chart is just a 
horizontal bar chart which is rotated. It works fine if the canvas/view you 
paint to is a square. So the aspect ratio stays the same after the rotation, 
but if the canvas/view is a rectangle the canvas gets stretched (in x-axis 
direction) and compressed (in y-axis direction).

Unfortunately I don´t have the ability to fix it, maybe you can help?

Original comment by c.roessl...@googlemail.com on 4 Feb 2013 at 7:52

GoogleCodeExporter commented 9 years ago
It is an open-source project. Anyway "having the ability" can help. The 
vertical bar chart, as I said, was an experiment, so I don't see much value in 
it.

Original comment by dandrome...@gmail.com on 4 Feb 2013 at 9:44

GoogleCodeExporter commented 9 years ago
Issue 305 has been merged into this issue.

Original comment by dandrome...@gmail.com on 20 May 2013 at 8:15

GoogleCodeExporter commented 9 years ago
Its like the whole chart is stretched and the aspect ratio is messed up. I had 
a similar problem. i suggest instead of sacrificing quality use the horizontal 
orientation for now.

Original comment by zoalor...@gmail.com on 31 Dec 2013 at 1:47

GoogleCodeExporter commented 9 years ago
Hi i want to generate a bar graph with x axis as weekdays.Is it possible?

Original comment by rojeshar...@gmail.com on 12 May 2014 at 12:46