如何绘制动态图?

时间:2011-04-07 09:53:30

标签: android database graph

我必须从android

中的数据库中绘制一个动态数据图

任何关于此的示例代码都将受到赞赏。

2 个答案:

答案 0 :(得分:1)

我喜欢GraphViz,可以将图形生成为.gif文件。

答案 1 :(得分:0)

所以......很多......图表问题......

请在此处阅读:https://stackoverflow.com/questions/5156740/im-looking-for-fancy-charts-library-for-android/5157576#5157576

TeeChart beta公开:http://steema.com/entry/60

可以大力推荐TeeChart,这是一个很棒的图书馆。已经使用了一段时间了。由于我还没有把它放在任何地方,这里有一些我的“操作方法”文件:

TeeChart info:

Disable 3D:            chart.getAspect().setView3D(false);
Disable Legend:        chart.getLegend().setVisible(false);
Disable footer:     chart.getFooter().setVisible(false);
Disable header:     chart.getHeader().setVisible(false);

SOLVED - How to set marks to data value instead of cylinder number?
    For a Bar data-set: bar.getMarks().setStyle(MarksStyle.VALUE);

SOLVED - How to move the marks closer to the chart rectangle?
    bar.getMarks().setArrowLength(5); - or negative values to put them on top of the bar

SOLVED - Different styles:
    bar.setBarStyle(BarStyle.RECTANGLE);

SOLVED - How do I put a heavier color reference (in terms of readability) on the legend? Thicker (higher) line, not wider
    chart.getLegend().setColorWidth(100); makes it wider, but not thicker or anything
    chart.getLegend().setFontSeriesColor(true); helps with the issue by also coloring the text
    line.getLinePen().setWidth(5); works, but it will change the width of the line as well.
    No legend callback yet.


SOLVED - How do I make the lines thicker in a graph?
    line.getLinePen().setWidth(5); works, but it will change the width of the Legend as well.

SOLVED - How do I change the color of labels on axes?
        chart.getAxes().getLeft().getLabels().getFont().setColor(Color.WHITE);
        chart.getAxes().getBottom().getLabels().getFont().setColor(Color.WHITE);


SOLVED WORKAROUND - How do I set the background color of the chart itself? Tried so far (the TChart methods that take a Color from the TChart Color class, not the View methods) - only managed to make the 'surrounding' area black.
        chart.setBackground(Color.BLACK);
        chart.getCanvas().setBackColor(Color.BLACK);
        chart.getGraphics3D().setBackColor(Color.BLACK);
            ---> WORKAROUND: Use the setBackground above, then use: chart.getWalls().getBack().setVisible(false); --- setColor() on walls is bugged?


SOLVED - How to choose the bounds of a chart manually?
    chart.getAxes().getLeft().setAutomatic(false);
    chart.getAxes().getLeft().setMinMax(-2, 2);