JqPlot - How to change a negative color

I use jqPlot to draw a graphwith default sequences from default to . I can change and , but I have not found a way to change the color of the line or fill the color below the zero line of the x axis. I want a positive value with green and a negative value of red. Currently, the negative default is blue. Here is the jqPlot option: fill: true, fillToZero: trueuseNegativeColorstruecolorfillColor

var chartOptions = {
    title: { show: false },
    axesDefaults: {
        show: false,
        showGridline: false,
        borderWidth: 0,
        showTicks: false,
        showTickMarks: false,
        tickOptions: {
            show: false,
            showLabel: false,
            showMark: false,
            showGridline: false
        }
    },
    axes: {
        xaxis: { min: 0, max: 10 },
        yaxis: { min: -5, max: 5 }
    },
    seriesDefaults: {
        fill: true,
        fillToZero: true,
        fillAndStroke: true,
        color: "rgba(190,230,110, 0.8)",
        fillColor: "rgba(206,236,145, 0.8)",
        shadow: false,
        showMarker: false,
        lineWidth: 1,
        rendererOptions: {
            highlightMouseOver: false
        }
    },
    legend: { show: false },
    grid: {
        drawGridLines: false,
        background: "rgba(255,255,255,0)",
        shadow: false
    }
};

Edit: Add information: current negative default value is blue

+5
source share
1 answer

- :

this.negativeSeriesColors = [ "#498991", "#C08840", "#9F9274", "#546D61", "#646C4A", "#6F6621", "#6E3F5F", "#4F64B0", "#A89050", "#C45923", "#187399", "#945381", "#959E5C", "#C7AF7B", "#478396", "#907294"];

fillToZero: http://www.jqplot.com/tests/fillToZero.php

fillToZero , . , . "negativeSeriesColors". "seriesColors".

.

, :

var chartOptions = {
    ...,
    negativeSeriesColors: ["#F94545", ...],
};
$.jqplot('chart1', data, chartOptions);
+8

All Articles