CanvasJS从数据颜色更改工具提示颜色

时间:2016-08-16 05:26:42

标签: javascript jquery html charts canvasjs

我正在使用canvas.js,它运行正常。我只是想改变tooltip的颜色。我尝试使用以下代码

 toolTip: {
            enabled: true,
            animationEnabled: true,
            fontColor: "red",
            Content: "{x} : {y}",
          },

通过它不会改变整个工具提示颜色。 我怎么能这样做。

这是我的JS

var chartResponses = new CanvasJS.Chart("chartResponses", {
                animationEnabled: true,
                toolTip: {
                    enabled: true,
                    animationEnabled: true,
                    fontColor: "red",
                    Content: "{x} : {y}",
                    color: "rgba(0, 0, 0, 0.25)",
                },
                axisX: {
                    titleFontFamily: "verdana",
                    valueFormatString: "D/M/YYYY",
                    tickThickness: 0,
                    lineThickness: 1,
                    gridThickness: 0,
                    gridColor: "#f2f6f7",
                    lineColor: "#f2f6f7",
                    labelFontColor: "#8fa2aa",
                    labelFontSize: 12
                },
                axisY: {
                    titleFontFamily: "verdana",
                    valueFormatString: "0",
                    tickThickness: 0,
                    lineThickness: 0,
                    gridThickness: 1,
                    gridColor: "#f2f6f7",
                    lineColor: "#f2f6f7",
                    labelFontColor: "#8fa2aa",
                    labelFontSize: 12
                },
                data: [{
                        type: "splineArea",
                        showInLegend: true,
                        markerSize: 0,
                        name: "",
                        color: "rgba(29, 176, 237, 0.25)",
                        dataPoints: allResponses
                    }],
            });

    chartResponses.render();

enter image description here

0 个答案:

没有答案