chartJS中的条形图可以使用highlightFill属性更改突出显示上的填充颜色:

http://www.chartjs.org/docs/#bar-chart-data-structure

var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
    {
        label: "My First dataset",
        fillColor: "rgba(220,220,220,0.5)",
        strokeColor: "rgba(220,220,220,0.8)",
        highlightFill: "rgba(220,220,220,0.75)",
        highlightStroke: "rgba(220,220,220,1)",
        data: [65, 59, 80, 81, 56, 55, 40]
    },
    {
        label: "My Second dataset",
        fillColor: "rgba(151,187,205,0.5)",
        strokeColor: "rgba(151,187,205,0.8)",
        highlightFill: "rgba(151,187,205,0.75)",
        highlightStroke: "rgba(151,187,205,1)",
        data: [28, 48, 40, 19, 86, 27, 90]
    }
]};


但是,雷达图不具有以下属性:

var data = {
    labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.2)",
            strokeColor: "rgba(220,220,220,1)",
            pointColor: "rgba(220,220,220,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(220,220,220,1)",
            data: [65, 59, 90, 81, 56, 55, 40]
        },
        {
            label: "My Second dataset",
            fillColor: "rgba(151,187,205,0.2)",
            strokeColor: "rgba(151,187,205,1)",
            pointColor: "rgba(151,187,205,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(151,187,205,1)",
            data: [28, 48, 40, 19, 96, 27, 100]
        }
    ]
};


关于如何扩展雷达图以使用该属性的任何想法?

最佳答案

雷达图与条形图的不同之处在于,区域实际上是整个序列(对于条形图,它是单个数据点)。

当您获得雷达工具提示时,考虑一下它代表海图的哪个区域,您就会意识到它基本上只代表从中心辐射的2个点。序列2点之间的区域实际上是在它们之间共享的。突出显示一半的面积也不好看。



除此之外,一个雷达图系列可以完全覆盖第二个雷达图这一事实,我想不出一种容易混淆的方式来为雷达图提供悬停突出显示(只要考虑一下如何突出显示)即可。折线图区域-您不这样做,只能做一个点)

09-28 02:41