我正在與酒窩js一起工作,我想要更改圖表的寬度並重新繪製它,我該怎麼做。我試圖chart.width()
甚至chart.newSvg()
,但這些都沒有實現我的樣品javascript
線圖,我把它放在jsfiddle
Jsfiddle
JavaScript代碼:更改酒窩js圖的寬度
var svg = dimple.newSvg("#chartContainer", 600, 400),
data = [
{ "Value" : 10, "Year" : 2009 },
{ "Value" : 5, "Year" : 2010 },
{ "Value" : 4, "Year" : 2011 },
{ "Value" : 7, "Year" : 2012 },
{ "Value" : 10, "Year" : 2010 },
{ "Value" : 50, "Year" : 2020 },
{ "Value" : 40, "Year" : 2015 },
{ "Value" : 100, "Year" : 2014 },
{ "Value" : 200, "Year" : 2014 }
];
var chart = new dimple.chart(svg, data);
var x = chart.addCategoryAxis("x", "Year");
x.addOrderRule("Year");
var y = chart.addMeasureAxis("y", "Value");
chart.addColorAxis("Value", ["green", "yellow", "red"]);
var lines = chart.addSeries(null, dimple.plot.line);
lines.lineWeight = 4;
lines.lineMarkers = true;
chart.ease = "bounce";
chart.staggerDraw = true;
chart.draw(2000);
你可以把它放在以前的jsfiddle這條線? – BomberMan
@Hardik Anavadia http://jsfiddle.net/mmhwvzwm/ –