本文介绍了柱状图AchartEngine不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建条形图使用 AchartEngine ,但各种事情不会为我工作..

1)无法显示网格。

2)无法删除类别系列标题即棒图。

3)它没有显示酒吧,它应该显示。

4)默认的白色背景是可见的。

是有可能的每个酒吧??

之间提供空间

条形图code

  CategorySeries系列=新CategorySeries(棒图);    的for(int i = 0; I< availCatList.size();我++)
       series.add(availCatList.get(ⅰ),mTotal.get(ⅰ));        XYMultipleSeriesDataset数据=新XYMultipleSeriesDataset();
        dataset.addSeries(series.toXYSeries());        XYSeriesRenderer seriesRenderer =新XYSeriesRenderer();
        seriesRenderer.setChartValues​​Spacing(0.5F);
        seriesRenderer.setDisplayChartValues​​(真);
        seriesRenderer.setColor(Color.GREEN);        XYMultipleSeriesRenderer mRenderer =新XYMultipleSeriesRenderer();
        mRenderer.setChartTitle(条形图);
        mRenderer.setShowGrid(真);
        mRenderer.setAxisTitleTextSize(15);
        mRenderer.setXLabelsAlign(Align.CENTER);
        mRenderer.setXTitle(分类);
        mRenderer.setYTitle(数量);
        mRenderer.setScale(1.0F);        的for(int i = 0; I< availCatList.size();我++){            mRenderer.addXTextLabel第(i + 1,availCatList.get(ⅰ));
        }        mRenderer.setXLabels(0);        mRenderer.addSeriesRenderer(seriesRenderer);        鉴于= ChartFactory.getBarChartView(这一点,数据集,mRenderer,
                Type.DEFAULT);        // layout.removeAllViews();        layout.addView(视图);

任何帮助将是非常美联社preciated ..

感谢


解决方案

  1. mRenderer.setShowGrid(真)工作在演示code所有的例子罚款。尝试使用设置另一种颜色 mRenderer.setGridColor(彩色);

  2. 您的意思是传说: mRenderer.setShowLegend(假);

  3. series.add(mTotal.get(I)); 是条形图的正确用法

  4. 从配置文件的可能。只需设置自己的背景颜色。

杆间距:读 mRenderer.setBarSpacing()API的;

I am trying to create Bar Chart using AchartEngine but various things doesn't work for me..

1) Unable to show Grid.

2) Unable to remove category series title i.e "Bar Graph".

3) It's not showing bars as it should show.

4) By Default white color background is visible.

is it possible to provide space between each bars??

Bar Chart Code

    CategorySeries series = new CategorySeries("Bar Graph");

    for (int i = 0; i < availCatList.size(); i++)
       series.add(availCatList.get(i), mTotal.get(i));

        XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
        dataset.addSeries(series.toXYSeries());

        XYSeriesRenderer seriesRenderer = new XYSeriesRenderer();
        seriesRenderer.setChartValuesSpacing(0.5f);
        seriesRenderer.setDisplayChartValues(true);
        seriesRenderer.setColor(Color.GREEN);

        XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
        mRenderer.setChartTitle("Bar Chart");
        mRenderer.setShowGrid(true);
        mRenderer.setAxisTitleTextSize(15);
        mRenderer.setXLabelsAlign(Align.CENTER);
        mRenderer.setXTitle("Categories");
        mRenderer.setYTitle("Amount");
        mRenderer.setScale(1.0f);

        for (int i = 0; i < availCatList.size(); i++) {

            mRenderer.addXTextLabel(i + 1, availCatList.get(i));
        }

        mRenderer.setXLabels(0);

        mRenderer.addSeriesRenderer(seriesRenderer);

        view = ChartFactory.getBarChartView(this, dataset, mRenderer,
                Type.DEFAULT);

        // layout.removeAllViews();

        layout.addView(view);

Any Help would be highly appreciated..

Thanks

解决方案
  1. mRenderer.setShowGrid(true) works fine in all the examples in the demo code. Try to set another color using mRenderer.setGridColor(color);
  2. You mean the legend: mRenderer.setShowLegend(false);
  3. series.add(mTotal.get(i)); is the correct usage for bar charts.
  4. That's probably from the profile. Just set your own background color.

Space between bars: read the APIs for mRenderer.setBarSpacing();

这篇关于柱状图AchartEngine不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 13:00