在dimplejs中使用百分比Axis的散点图

时间:2018-01-03 13:59:50

标签: javascript d3.js dimple.js

我正在尝试使用百分比轴创建散点图。但它不起作用。

var chart = new dimple.chart(svg);
                var x = chart.addCategoryAxis("x", "Fruit");
                var y1 = chart.addPctAxis("y", "Value");
                var y2 = chart.addPctAxis("y", "Value");
                var s1 = chart.addSeries("Year", dimple.plot.bubble, [x, y1]);
                s1.data = [
                    { "Value" : 10, "Fruit" : "Grapefruit", "Year" : 2012 },
                    { "Value" : 40, "Fruit" : "Apple", "Year" : 2012 },
                    { "Value" : 12, "Fruit" : "Banana", "Year" : 2012 }
                ];
                var s2 = chart.addSeries("Year", dimple.plot.bubble, [x, y2]);
                s2.data = [
                    { "Value" : 11, "Fruit" : "Grapefruit", "Year" : 2013 },
                    { "Value" : 30, "Fruit" : "Apple", "Year" : 2013 },
                    { "Value" : 14, "Fruit" : "Banana", "Year" : 2013 }
                ];
                chart.draw();

以下是jsfiddle链接: http://jsfiddle.net/chetan119/NCW89/142/

1 个答案:

答案 0 :(得分:0)

addPctAxis更改为addMeasureAxis

参考:example