Skip to content

Commit

Permalink
Highstock: Fixed #8212, improved API reference of dataLabel.y and add…
Browse files Browse the repository at this point in the history
…ed API reference of pointValKey for ohlc series.
  • Loading branch information
KacperMadej authored and TorsteinHonsi committed May 14, 2018
1 parent 4967554 commit 88e8c48
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 2 deletions.
12 changes: 12 additions & 0 deletions js/parts/OHLCSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ seriesType('ohlc', 'column', {
}
},

/**
* Determines which one of `open`, `high`, `low`, `close` values should be
* represented as `point.y`, which is later used to set dataLabel position.
*
* @type {String}
* @validvalue ["open", "high", "low", "close"]
* @product highstock
* @sample {highstock} stock/plotoptions/ohlc-pointvalkey/
* Possible values
* @default close
* @apioption plotOptions.ohlc.pointValKey
*/

/**
* Line color for up points.
Expand Down
4 changes: 2 additions & 2 deletions js/parts/Series.js
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@ H.Series = H.seriesType('line', null, { // base series options


/**
* The x position offset of the label relative to the point.
* The x position offset of the label relative to the point in pixels.
*
* @type {Number}
* @sample {highcharts}
Expand All @@ -1884,7 +1884,7 @@ H.Series = H.seriesType('line', null, { // base series options


/**
* The y position offset of the label relative to the point.
* The y position offset of the label relative to the point in pixels.
*
* @type {Number}
* @sample {highcharts}
Expand Down
6 changes: 6 additions & 0 deletions samples/stock/plotoptions/ohlc-pointvalkey/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: Highcharts Stock Demo
authors:
- Torstein Hønsi
js_wrap: b
...
4 changes: 4 additions & 0 deletions samples/stock/plotoptions/ohlc-pointvalkey/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div id="container" style="height: 400px; min-width: 600px"></div>

<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
70 changes: 70 additions & 0 deletions samples/stock/plotoptions/ohlc-pointvalkey/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

Highcharts.chart('container', {
chart: {
type: 'candlestick'
},

title: {
text: 'Possible values for pointValKey'
},

plotOptions: {
series: {
dataLabels: {
enabled: true,
borderRadius: 5,
backgroundColor: 'rgba(252, 255, 197, 0.7)',
borderWidth: 1,
borderColor: '#AAA',
format: '{point.series.name}'
},
grouping: false
}
},

xAxis: {
categories: ['on open', 'on high', 'on low', 'on close (default)']
},

series: [{
name: 'open',
pointValKey: 'open',
data: [{
x: 0,
high: 100,
low: 0,
open: 30,
close: 50
}]
}, {
name: 'high',
pointValKey: 'high',
data: [{
x: 1,
high: 100,
low: 0,
open: 30,
close: 50
}]
}, {
name: 'low',
pointValKey: 'low',
data: [{
x: 2,
high: 100,
low: 0,
open: 30,
close: 50
}]
}, {
name: 'close',
pointValKey: 'close', // default
data: [{
x: 3,
high: 100,
low: 0,
open: 30,
close: 50
}]
}]
});

0 comments on commit 88e8c48

Please sign in to comment.