当我放大图表时,可以看到类似的日期,26 Apr, 9:05但是当我缩小图表时,只能看到类似的时间9:00。如何一直显示日期?这是我的图(https://codepen.io/anon/pen/GLPPGq):am4core.useTheme(am4themes_animated);var chart = am4core.create("chartdiv", am4charts.XYChart);chart.dataSource.url = "https://api.myjson.com/bins/i3np8";chart.dataSource.events.on("parseended", function(ev) { var data = ev.target.data; data.sort(function(lhs, rhs) { return lhs.time - rhs.time; }); data.forEach(function(item) { item.time *= 1000; });});chart.numberFormatter.numberFormat = "#.0b";chart.dateFormatter.inputDateFormat = "x";var dateAxis = chart.xAxes.push(new am4charts.DateAxis());dateAxis.dateFormats.setKey("minute", "d MMM, \nHH:mm");dateAxis.periodChangeDateFormats.setKey("minute", "d MMM, \nHH:mm");dateAxis.startLocation = 0.5;dateAxis.endLocation = 0.5;var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());valueAxis.tooltip.disabled = true;var series = chart.series.push(new am4charts.LineSeries());series.dataFields.dateX = "time";series.name = "Traffic out";series.dataFields.valueY = "outDiffFormatted";series.tooltipHTML = "<span style='font-size:14px; color:#000000;'><b>{valueY.value}</b></span>";series.tooltipText = "[#000]{valueY.value}[/]";series.tooltip.background.fill = am4core.color("#FFF");series.tooltip.getStrokeFromObject = true;series.tooltip.background.strokeWidth = 3;series.tooltip.getFillFromObject = false;series.fillOpacity = 0.6;series.strokeWidth = 2;series.stacked = false;
添加回答
举报
0/150
提交
取消