我有一个带有两个或多个带 dateAxis 的 XYCharts 的容器,我想使用 jQuery 滑块同时更改容器中所有图表的缩放比例。我试图让下面的函数运行,但它不起作用。$("#slider-range").slider({ animate: "fast", range: true, min: 0, max: 1, step: 0.01, values: [0, 1], slide: function (event, ui) { for (var i = 0; i < container.children.length; i++) { container.children[i].dateAxis[0].start = ui.values[0]; container.children[i].dateAxis[0].end = ui.values[1]; } }});我总是收到错误消息“无法读取未定义的属性 'dateAxis'”这是我的代码:am4core.ready(function () { am4core.useTheme(am4themes_animated); container = am4core.create("container", am4core.Container); container.width = am4core.percent(100); container.height = am4core.percent(100); container.layout = "vertical";});function createSimpleLineChart() { var chart = container.createChild(am4charts.XYChart); ... var dateAxis = chart.xAxes.push(new am4charts.DateAxis()); dateAxis.baseInterval = { "timeUnit": "second", "count": 1 }; ... return chart;}
添加回答
举报
0/150
提交
取消