Chart JS custom tooltip option?

后端 未结 7 730
野趣味
野趣味 2020-12-03 03:44

I am trying to build chart using Chart.Js. This chart.js has default option for tooltip, I want to make customized tooltip option. Is there a way to make it possible?

<
相关标签:
7条回答
  • 2020-12-03 04:16

    The new version of chart.js, version 2, is found here:

    https://github.com/nnnick/Chart.js/releases

    Version 2 adds tooltip callbacks:

    Every tooltip callback (beforeTitle, title, afterTitle, etc..) accepts a string or an array. If an array is used, it will produce multiple lines. Tooltips now come with a lot more options for visual customization as well.


    However, there is a fork of chart.js called chartNew.js, found here:

    https://github.com/FVANCOP/ChartNew.js/

    It adds several great enhancements to the venerable chart.js, including:

    • tooltip functions (when download/unzip, look in the Samples folder and look at annotateFunction.html. When hover over any point, you can do anything.)

    • passing an array of colors to a bar chart (instead of each bar in series having the same color)

    • putting text on the chart wherever you want it

    many etceteras.


    Note that chart.js has been greatly enhanced in version 2, but the new version is not fully backwards compatible (just changing to the v2 plugin broke my existing code) whereas chartNew.js will work with old code whilst extending capabilities.

    0 讨论(0)
提交回复
热议问题