Android:图表与CubicLineChart achartengine中的pointstyle不同步

时间:2014-07-20 16:55:11

标签: java android achartengine

我正在尝试使用库CubicLineChart Achartengine中的函数创建曲线图,但带有一条线的点未融合,如下所示:

enter image description here

我在我的图表中添加了更加流畅,但是点数更远,这是我的代码:

onPaint(){

                XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();

                XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();

                XYSeries mCurrentSeries = null;
                XYSeriesRenderer mCurrentRenderer;

               String [] bulan= {"jan", "feb", "mar", "apr", "jun", "jul", "agt", "sep", "okt", "nov", "des"};

                int[] colors = new int[] { Color.RED, Color.GREEN};
                PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE, PointStyle.CIRCLE};

    //          mDataset.removeSeries(mCurrentSeries);
                mRenderer = new XYMultipleSeriesRenderer();  

                mRenderer.setAxisTitleTextSize(14);
                mRenderer.setChartTitleTextSize(14);
                mRenderer.setLabelsTextSize(15);
                mRenderer.setLegendTextSize(15);
                mRenderer.setMargins(new int[] { 0, 15, 10, 0 });
                mRenderer.setZoomButtonsVisible(false);//untuk hilangin zoomnya
                mRenderer.setPanEnabled(false, false);
                mRenderer.setZoomEnabled(false, false);
                mRenderer.setPointSize(2f);
                mRenderer.setMarginsColor(Color.TRANSPARENT);
                mRenderer.setShowGrid(true);

                String seriesTitle = "";
                XYSeries series = new XYSeries(seriesTitle);
                mDataset.addSeries(series);
                mCurrentSeries = series;
                XYSeriesRenderer renderer = new XYSeriesRenderer();
                renderer.setFillBelowLine(true);
                renderer.setFillBelowLineColor(Color.TRANSPARENT);
                renderer.setColor(Color.BLUE);
                renderer.setPointStyle(PointStyle.CIRCLE);
                mRenderer.addSeriesRenderer(renderer);
                mRenderer.setInScroll(true);
                mRenderer.setShowLegend(false);
                mRenderer.setShowGridX(true);
                mRenderer.setShowGridY(false);
                mRenderer.setXLabels(bulan.length);
                mRenderer.setYLabels(5);
                mRenderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));//hilangin background hitam disekeliling grafik

                renderer.setFillPoints(true);
                mCurrentRenderer = renderer;


                for (int i = 0; i < bulan.length; i++) {
                    mCurrentSeries.add(i,jumlah[i]);
                }

                        if (mChartView != null) {
                            piechart.removeView(mChartView);
                        }
                        mChartView = ChartFactory.getCubeLineChartView(applicationContext,  mDataset, mRenderer, 0.17f);
                        piechart.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

                        pw_kn.showAtLocation(popUpKN, Gravity.CENTER, 0, 0);
            }

我的代码有问题吗?

0 个答案:

没有答案