图表显示两行具有相同ID和日期的

时间:2018-02-06 18:47:14

标签: javascript html angularjs charts

我试图在以下两种情况下实现: 1)在ID和日期相同但描述不同的图表中,在这种情况下,我想在不同的行中显示它们 2)当没有足够的空间来显示我希望在其他行中显示的行标签。在我的演示中,描述“可以在此处发送第二个数据”,我们可以看到时间轴,但标签没有显示,因为没有足够的放置标签的地方。

参考:Google Timeline chart to display 2 rows of same names

我试过从上面的链接跟随但是没有成功。 我无法使用groupByRowLabel: false,因为我想在同一行显示多个时间轴。

js code:

    $scope.display = function() {
     Array.prototype.forEach.call(container.getElementsByTagName('text'), function (label) {
    if (label.textContent.indexOf('|') > -1) {
    label.textContent = label.textContent.split('|')[1];
     alert(label.textContent);
  }
});
   }       
    $scope.myChart = chart1;

});

1 个答案:

答案 0 :(得分:2)

场景中的

...... 1)根本没有足够的空间在同一行上显示完全相同日期的两个标签,
一个人总是会覆盖另一个

2)唯一的方法是知道标签是否因尺寸而无法显示,
是检查图表reportResult = []; responseResult = []; isFinished = false; onScroll () { if(!this.isFinished) { const condition = this.dbQuery + '.skip(' + this.reportResult.length + ').limit(100)'; this.execute(condition); } } execute(qry){ const that = this; $('#loading').show(); this.reportService.getReportData(qry).then((data: any) => { this.isPageValid = true; $('#loading').hide(); try{ if(data.operation == "SUCCESS"){ if(data.data === "]") { that.toastr.warning("No results found, please refine your conditions!","Report"); }else{ that.responseResult = JSON.parse(that.stringifyJson(data)); if(that.responseResult.length < 100) { that.isFinished = true; } for(let i = 0; i < that.responseResult.length; i++) { that.reportResult.push(that.responseResult[i]); } } } else { that.toastr.warning("Data size is larger, please refine your conditions!","Report"); } } catch(err){ $('#loading').hide(); that.toastr.warning("Data size is larger, please refine your conditions!","Report"); } },function(err){ $('#loading').hide(); that.toastr.warning("Data size is larger, please refine your conditions!","Report"); }); } 事件的图表元素 对于每个行标签,图表中应该有一个'ready'元素 如果没有,那个行标签丢失了,
此时您将更改数据并再次绘制

像这样......

<text>