Google运动图初始状态 - 为滑块设置时间单位 [英] Google motion chart initial state - set time unit for slider
问题描述
我正在使用 Google运动图表,在底部有一个播放按钮和滑块,用于动画显示图表。我想设置滑块使用的时间单位/步数。默认情况似乎是一天(D)。
我的drawChart方法设置了初始状态,我试着将timeUnit设置为M - duration:{multiplier:1,timeUnit :M} - 月,但这并没有改变任何东西。我找不到任何有关初始状态变量可能设置的文档。
以下是我设置状态的方法:
函数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吗?如何更改滑块以使用月份而不是日期来执行步骤?
documentation 表示:
第二列必须包含时间值。时间可以用以下任何格式表示:
- 年 - 列类型:'数字'。例如:2008年。
- 月,日和年 - 列类型:'date';值应该是javascript日期实例。
- 周数 - 列类型:'string';值应该使用符合ISO 8601的模式YYYYWww。示例:'2008W03'。
- Quarter - 列类型:'string';例如:'2008Q3'。
阅读另一个线程,它看起来像就像谷歌将它扔在垃圾桶里一样,并不会增加时间单位。
I am working with a Google Motion Chart with has a play button and slider at the bottom that animates the chart. I would like to set the time unit/steps used by the slider. The default seems to be a day ("D").
My drawChart method sets the initial state and I tried setting the timeUnit to "M" - "duration":{"multiplier":1,"timeUnit":"M"} - for month but this did not change anything. I could not find any documentation on possible settings for the initial state variables.
Below is my method which sets the state:
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);
}
Is "M" the setting for month? How do I change the slider to use months instead of days for its steps?
The documentation says:
The second column must contain time values. Time can be expressed in any of the following formats:
- Year - Column type: 'number'. Example: 2008.
- Month, day and year - Column type: 'date'; values should be javascript Date instances.
- Week number- Column type: 'string'; values should use the pattern YYYYWww, which conforms to ISO 8601. Example: '2008W03'.
- Quarter - Column type: 'string'; the values should have the pattern YYYYQq, which conforms to ISO 8601. Example: '2008Q3'.
Reading another thread, it looks like Google is throwing this in the trash and are not going to be enhancing the time units.
这篇关于Google运动图初始状态 - 为滑块设置时间单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!