这是什么图表API /工具?

时间:2011-08-02 17:31:58

标签: api html5 charts

这是什么图表API /工具?

http://wordpress.org/extend/plugins/multiple-post-thumbnails/stats/

饼图至少是iframe内的svg画布。我很困惑他们正在使用什么,但我喜欢它。

image http://img38.imageshack.us/img38/6513/picturets.png

1 个答案:

答案 0 :(得分:1)

    google.load("visualization", "1", {packages: ["corechart"]});
    google.setOnLoadCallback(drawChart);
    function drawChart() {
        jQuery.getJSON('http://api.wordpress.org/stats/plugin/1.0/multiple-post-thumbnails?callback=?', function (data) {
            draw_graph(data, 'version_stats', 'Active Versions');
        });
    }
    function draw_graph(versions, id, title) {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Version');
        data.addColumn('number', 'Usage');
        var count = 0;
        jQuery.each(versions, function (key, value) {
            if (Number(value) > 1) {
                data.addRow();
                data.setValue(count, 0, key);
                data.setValue(count, 1, Number(value));
                count++;
            }
        });

        var chart = new google.visualization.PieChart(document.getElementById(id));
        chart.draw(data, {width: 360, height: 240, title: title});
    }

看起来他们正在使用Google的图表API:http://code.google.com/apis/chart/interactive/docs/index.html