本文介绍了实现一个图表AFreeChart进入查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的问题:我使用 AFreeChart 来显示一个图表中我的活动。为什么我用的原因 AFreeChart 是因为我第一次完成了这个图表的JFreeChart ,并在那之后意识到,它不是, 'T与Android兼容。

Here is my problem: I am using AFreeChart to display a chart in my activity. The reason why I used AFreeChart was because I first finished this chart with JFreeChart, and, realized after that, it wasn't compatible with Android.

所以,用 AFreeChart ,我可以创建相同图表完全相同的code,但我不知道如何在<$显示它C $ C>查看。

So, with AFreeChart, I could create the same chart with exactly the same code, but I don't know how to display it on a View.

在这里,我创建图表:

private void creerGraphique(){

    //Here I have the creation of the DateSet

    AFreeChart chart = ChartFactory.createXYLineChart(
                "Mois", // Title
                "Jours", // x-axis Label
                "Repetitions", // y-axis Label
                graph, // Dataset
                PlotOrientation.VERTICAL, // Plot Orientation
                true, // Show Legend
                true, // Use tooltips
                false // Configure chart to generate URLs?
            );
}

在这里,我想用它:

Here I want to use it:

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.graphique);

    this.stockTableau();
    this.creerGraphique();

            //HERE: How can I display it since it's already created
}

我下载了 AFreeChart 演示code,但一个函数,它是不是在包装上使用,所以,我不能使用它。

I downloaded the AFreeChart demo code, but a function which wasn't on the package was used, and so, I couldn't use it too.

我感谢你的帮助。

PS:我不是英语,所以我希望我的问题是清楚的,请不要犹豫,问我的详细信息

PS: I'm not an english, so I hope my problem is clear, do not hesitate to ask me more details.

推荐答案

你看在AFreeChart样?这是很简单的,看看他们做此图表,例如:

Have you looked at the sample in AFreeChart? It's quite straight forward, look at what they did for this chart for instance :

<一个href="http://$c$c.google.com/p/afreechart/source/browse/trunk/afreechart_sample/src/org/afree/chart/demo/view/PieChartDemo01View.java" rel="nofollow">http://$c$c.google.com/p/afreechart/source/browse/trunk/afreechart_sample/src/org/afree/chart/demo/view/PieChartDemo01View.java

他们伸出DemoView这基本上是一个setChart方法一个Android视图,图表传递给视图。
因此,无论是延长DemoView或创建您自己的等价的,如果你并不需要的一切,在它,并按照样品!

They extend a DemoView which is basically an Android View with a setChart method, and pass the chart to the View.
So either extend DemoView or create you own equivalent if you don't need everything that's in it and follow the sample !

祝你好运。

这篇关于实现一个图表AFreeChart进入查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 21:39