Highcharts Column chart contains a method for setting different colors of the positive and negative columns

Source: Internet
Author: User

Recently done mobile data graph, need to set the positive and negative two pillars, as well as positive and negative two pillars display different colors, view API, helpless API too large, ask Google, great Google gave me the right answer

I have a working chart with negative values. I would like to has columns with positive values to being blue and columsn with negative vlaues to be red.

Here's what I have:

Translation: I have a negative value for the worksheet. I think the positive values of the bars are blue and columsn negative is.

Here is my:

The code's not going to stick.

Here's the answer:

Since you aren't describing how is populating for moda your The data series here is some generalities:

  • The series.data.color item is accessible. So, when building the series.data "up" could calculate what color it should is based on the value.
  • Allowing one color in your list:colors: [ ‘blue‘ ],
  • Another option is to set the negativeColor .

Since you can't describe how you populate moda your data series, here are some common features:

  • series.data.coloritems available. So when building series.data you can figure out what color it should be based on value.
  • You are only allowed in your list, a color:colors: [ ‘blue‘ ],
  • The other option is set negativeColor .

Reference Address: http://4byte.cn/question/258586/highcharts-column-with-negative-values-column-color.html

API Address: Http://www.hcharts.cn/api/index.php#plotOptions.column.negativeColor

Demo Address: http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/ highcharts/plotoptions/arearange-negativecolor/

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/ plotoptions/series-negative-color/

//daily rate of return(function () {        if($ ("#everyday_charts"). length==0){            return false; }        $(' #everyday_charts '). Highcharts ({chart: {type:' Column '}, Title: {text:NULL}, Xaxis: {categories: [' 09-14 ', ' 09-15 ', ' 09-16 ', ' 09-17 ', ' 09-18 ', ' 09-19 ', ' 09-20 ', ' 09-21 ', ' 09-22 ', ' 09-23 ', ' 09-24 ', ' 09-25 ', ' 09-26 ', ' 09-27 ' ', ' 09-28 ', ' 09-29 ', ' 09-30 ', ' 10-01 ', ' 10-02 ', ' 10-03 ', ' 10-04 ', ' 10-05 ', ' 10-06 ', ' 10-07 ', ' 10-08 ', ' 10-09 ', ' 10-10 ', ' 10-11 ', ' 10-12 ', ' 10-13 ', ' 10-14 '], Labels: {step:5//Set X-axis interval How many displays}}, YAxis: {title: {text:NULL                }}, Series: [{color:' #ff2c55 ', Negativecolor:' #00ce9b ',//is the color of this property setting a negative valueData: [15,12,-10,15,12,15,12,-10,20,12,-5,-10,20,12,-5,20,15,12,-10,20,12,-5,15,-5,12,-5,15,12,12,-5]}], credits: {enabled:false}, legend:{enabled:false}, credits:{//Copyright InformationEnabledfalse}, tooltip:{//data point Prompt boxEnabledfalse            }        }); })();

Highcharts Column chart contains a method for setting different colors of the positive and negative columns

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.