wangyao5 / achartengine

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

All Points are aligned with the x axis #266

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I use achartengine in my own project but can reproduce the bug in the demo code 
All Points are x | y

What steps will reproduce the problem?
1. Run the demo code
2. Select Embedded line char demo
3. Hit new series, enter a Point e.g. 5 | 6
5. Now enter an additional Point e.g. 10 | 10 (see attached screenshot)

What is the expected output? What do you see instead?

I'd expect to see a straight line. Instead I see no values on the y-axis and 
all points aligned at the x axis. This does not happen every time, only 
sometimes. In my own application I use the code below. Sometimes, when the 
chart starts with the value 1 | 0 and then there is another point, e.g. 5 | 20, 
all points remain on the x axis. If it starts with 1 | 3, everything works 
fine... 

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

This is my code, it gets updated by a thread

private class Linegraph {

        //at the moment only one value is allowed
        private TimeSeries dataset = new TimeSeries(properties.get(0));
        private XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();
        private XYSeriesRenderer renderer = new XYSeriesRenderer();
        private XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();

        public Linegraph() {
            mDataset.addSeries(dataset);

            renderer.setColor(Color.BLUE);
            renderer.setPointStyle(PointStyle.TRIANGLE);
            renderer.setFillPoints(true);

            // enable zoom
            mRenderer.setZoomButtonsVisible(true);
            mRenderer.setXTitle("Value #");
            mRenderer.setYTitle("Value");
            mRenderer.setLabelsTextSize(25);
            mRenderer.setLegendTextSize(25);
            mRenderer.setChartTitleTextSize(25);
            mRenderer.setAxisTitleTextSize(25);
            mRenderer.setYLabelsAlign(Align.LEFT);
            mRenderer.setXLabelsColor(Color.RED);
            mRenderer.setYLabelsColor(0, Color.RED);
            mRenderer.addSeriesRenderer(renderer);
            mRenderer.setYAxisMin(0);
            mRenderer.setXAxisMin(0);

        }

        public GraphicalView getView(Context context) {
            return ChartFactory.getLineChartView(context, mDataset, mRenderer);
        }

        public void addNewPoint(Point p) {
            dataset.add(p.getX(), p.getY());
        }

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

Please provide any additional information below.

Android 4.2.1 Nexus 7

I'd be very happy if you could find the cause.

Regards

Original issue reported on code.google.com by feodor.k...@googlemail.com on 16 Jan 2013 at 4:25

Attachments:

GoogleCodeExporter commented 9 years ago
Another image, this time taken from my app.

Logcat: 
01-16 17:29:41.798: D/DynamicGraphActivity(32401): Point added: Point [x=21, 
y=14]

Original comment by feodor.k...@googlemail.com on 16 Jan 2013 at 4:35

Attachments:

GoogleCodeExporter commented 9 years ago
When using -1 for the min values, it works just fine. Why is that?

Original comment by feodor.k...@googlemail.com on 16 Jan 2013 at 6:02

GoogleCodeExporter commented 9 years ago
Hard to understand your issue. The code you have posted is not useful. Why do 
you use a TimeSeries and not an XYSeries?

I was not able to replicate this in the demo app.

Original comment by dandrome...@gmail.com on 16 Jan 2013 at 6:59

GoogleCodeExporter commented 9 years ago
I followed this tutorial: http://youtu.be/E9fozQ5NlSo?t=7m14s
So this is nonsense?

I'll change it to XYSeries and watch if there will still be errors.

Thanks for pointing out the mistake!

Regards

Original comment by feodor.k...@googlemail.com on 17 Jan 2013 at 1:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Update: Seems to be working just fine
Issue may be closed.
Thanks

Original comment by feodor.k...@googlemail.com on 17 Jan 2013 at 1:43

GoogleCodeExporter commented 9 years ago
Oh really?
What was the problem?

Original comment by dandrome...@gmail.com on 17 Jan 2013 at 5:20

GoogleCodeExporter commented 9 years ago
Changed TimeSeries to XYSeries.

Original comment by feodor.k...@googlemail.com on 17 Jan 2013 at 6:01