7

I am working on Highstock, I am trying to set a color to a specific point in "data" in Highstock, like in the example, but I couldn't get it to work, no matter how I set the color, it doesn't show on the graph.

I have tried the option with Highchart API, it works, but it doesn't work with Highstock.

jsfiddle link(what I have tried)

Is it because I am using x, y to specify the point? Please help.

Community
  • 1
  • 1
leon
  • 10,085
  • 19
  • 60
  • 77
  • http://stackoverflow.com/questions/11985901/cannot-set-individual-point-color-in-series-for-highstock-api-it-works-for-high possible duplicate – Jugal Thakkar Aug 19 '12 at 06:03

2 Answers2

12

If you look to your demo you'll see that using color it sets the tooltip color and not the marker.

To fix it use marker fillColor instead, like the following.

data: [
    {x: 1343862840000, y: 4, marker:{ fillColor: 'red'} },
    {x:1343863200000, y:5, marker:{ fillColor: 'green'}}
]

demo

Update:
It works on highstock see this demo.
You have to init it using the right object.
Use Chart instead of StockChart.

reference

Ricardo Alvaro Lohmann
  • 26,031
  • 7
  • 82
  • 82
  • thanks for the reply. I just notice it only works for Highchart API, it doesn't work with Highstock, can you help me with Highstock? thanks – leon Aug 16 '12 at 10:54
  • @RicardoLohmann, good catch, can not believe I missed that. I even tryed `marker:{color...`, but missed the api's `fillcolor`. – Mark Aug 16 '12 at 13:36
  • Note that for Highcharts, the `color` option does set the color of the point - [example](http://jsfiddle.net/2nsg7kez/). – Dan Dascalescu Sep 28 '17 at 08:50
  • The demo doesn't actually use HighStock. Can you share a demo that uses and actual HighStock chart, e.g. a candlestick chart, with colored markers? If so, please post an answer to the question, rather than editing the question. Thanks! – Dan Dascalescu Sep 28 '17 at 09:04
3

Highstock has point markers disabled by default. You will need to enable them explicitly as follows:

plotOptions: {
    series: {
        marker: {
            enabled: true    
        }
    }
},

See more at http://api.highcharts.com/highstock/plotOptions.series.marker

Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404
leon
  • 10,085
  • 19
  • 60
  • 77