如何在ngx-chart-line-chart工具提示上对值进行排序

时间:2019-08-19 00:52:50

标签: angular linechart ngx-charts

这是一个折线图示例https://swimlane.github.io/ngx-charts/#/ngx-charts/line-chart

如果您将鼠标悬停在上面,则会看到工具提示:

enter image description here

您可以看到工具提示上的值未排序。反正有没有要对工具提示值进行排序?

1 个答案:

答案 0 :(得分:0)

是的,有。

您可以对数据进行排序:

this.data.sort(function (a, b) {
  return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
});

Stackblitz example