简体   繁体   English

Google Chart上的资源管理器不起作用-Polymer

[英]explorer on Google Chart does not work - Polymer

I'm using the google-chart web components but the explorer (that allow zooming in and out) does not work. 我正在使用google-chart Web组件,但是资源管理器(允许放大和缩小)不起作用。 Here is the code : 这是代码:

 options: { type:Array, value:{ title: 'Today Consumption', curveType: 'function', chartArea:{ backgroundColor: '#E2E8ED', height: 300, width: 650, }, explorer: { axis: 'horizontal', keepInBounds: true, maxZoomIn: 4.0 }, height: 400, width: 830, backgroundColor:'#E2E8ED', colors:["#4882A8"]} } }, 
 <google-chart type="line" options='{{options}}' data='{{chartData}}'></google-chart> 

It looks like that : 看起来像这样: 图表 But I'm unable to zoom in or out..? 但是我无法放大或缩小。 Does someone have an idea of why it doesn't work? 有人知道为什么它不起作用吗?

explorer only works with continuous axes (such as numbers, dates or timeofday) 资源管理器仅适用于连续轴(例如数字,日期或一天中的时间)

for the x-axis, use type --> 'timeofday' 对于x轴,请使用类型-> 'timeofday'
which should be an array with 3-4 elements... 应该是包含3-4个元素的数组...

[hour, min, second]
[hour, min, second, milli]

the following should convert your string values to a valid 'timeofday' 以下应将您的字符串值转换为有效的'timeofday'

var timeStr = '2h19m';
var hour = timeStr.split('h');
var min = hour[1].split('m');
var timeArr = [parseInt(hour[0]), parseInt(min[0]), 0];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM