我正在使用Google 动态图表,底部有一个播放按钮和滑块,可以为图表设置动画。我想设置滑块使用的时间单位/步长。默认值似乎是一天(“D”)。
我的 drawChart 方法设置了初始状态,我尝试将 timeUnit 设置为 "M" - "duration":{"multiplier":1,"timeUnit":"M"} - 一个月,但这并没有改变任何东西。我找不到任何关于初始状态变量可能设置的文档。
下面是我设置状态的方法:
function drawChart(data) {
var evalObj = eval("(" + data + ")");
var dataTbl = new google.visualization.DataTable(evalObj);
var motionchart = new google.visualization.MotionChart(document.getElementById('chart'));
var options = {};
options['state'] =
'{"iconKeySettings":[],"stateVersion":3,"time":"notime","xAxisOption":"_NOTHING","playDuration":15,
"iconType":"BUBBLE","sizeOption":"_UNISIZE","xZoomedDataMin":null,
"xZoomedIn":false, "duration":{"multiplier":1,"timeUnit":"M"},"yZoomedDataMin":null,"xLambda":1,"colorOption":"_UNIQUE_COLOR",
"nonSelectedAlpha":0.4,"dimensions":{"iconDimensions": []},"yZoomedIn":false,"yAxisOption":"_NOTHING","yLambda":1,"yZoomedDataMax":null,
"showTrails":false,"xZoomedDataMax":null};';
options['width'] = 800;
options['height'] = 400;
motionchart.draw(dataTbl, options);
}
“M”是月份的设置吗?如何更改滑块以使用月而不是天来执行其步骤?