2
votes

So by default if you use measure-x tool in stock tools of stock chart in highstock, it shows a red background and you can't see the chart behind the measure tool selected red box.

See a JSFiddle here

I want to make the red color as transparent as possible, if possible exactly like measure-y or measure-xy which has light white color with transparent background color. I am not able to understand how to do it?

My code:

Highcharts.stockChart('container', {
  yAxis: [{
    labels: {
      align: 'left'
    },
    height: '80%',
    resize: {
      enabled: true
    }
  }, {
    labels: {
      align: 'left'
    },
    top: '80%',
    height: '20%',
    offset: 0
  }],
  tooltip: {
    shape: 'square',
    headerShape: 'callout',
    borderWidth: 0,
    shadow: false,
    positioner: function(width, height, point) {
      var chart = this.chart,
        position;

      if (point.isHeader) {
        position = {
          x: Math.max(
            // Left side limit
            chart.plotLeft,
            Math.min(
              point.plotX + chart.plotLeft - width / 2,
              // Right side limit
              chart.chartWidth - width - chart.marginRight
            )
          ),
          y: point.plotY
        };
      } else {
        position = {
          x: point.series.chart.plotLeft,
          y: point.series.yAxis.top - chart.plotTop
        };
      }

      return position;
    }
  },
  series: [{
    type: 'ohlc',
    id: 'aapl-ohlc',
    name: 'AAPL Stock Price',
    data: ohlc
  }, {
    type: 'column',
    id: 'aapl-volume',
    name: 'AAPL Volume',
    data: volume,
    yAxis: 1
  }],
  responsive: {
    rules: [{
      condition: {
        maxWidth: 800
      },
      chartOptions: {
        rangeSelector: {
          inputEnabled: false
        }
      }
    }]
  }
});
1

1 Answers

1
votes

You can change the background color by the options:

navigation: {
    bindings: {
        measure: {
            annotationsOptions: {
                typeOptions: {
                    background: {
                        fill: 'rgba(50, 150, 50, 0.5)'
                    }
                }
            }
        }
    }
}

Live demo: https://jsfiddle.net/BlackLabel/o1g78rfd/