Highcharts Tooltip Displaying next Elements Data when Hover - highcharts

How can we show next elements data in tooltip when hovered ..
series: [{ name: 'brightness', data: [29.9, 71.5, 106.4]},
{ name: 'temperature',data: [16.4, 194.1, 95.6]}]
in the example i want to include when hovered on 29.9, brightness - 29.9 and temparature - 16.4 both .. shared option in the tooltip gives all the elements but i need immediate next elements data only..

Related

highcharts - add label by custom id

I have a sparkline chart of temperature sensor data,
Its a year of data sampled at every 1 min
I first load a blank chart, then I do a server call, bring the results back and display it by calling
getchart.addSeries({
name: thisGroup,
id: probeItem[0],
data: probeDataArray,
keys: ['x', 'y', 'specialId'],
there could be upto 20 series, and they all load on the screen one by one
This renders quite quickly, however I now need to add a label annotation where the temperature goes over a certain Value (i.e. in add a warning symbol when its alarm state)
Currently I'm looping through each point and seeing if its over a certain value:
currentSeries.points.forEach(function (point) {
However this is very slow.
I have an array of the alarms, and can reference them as
['x', 'y', 'specialId']
However I cannot see how I can add an annotation label by x,y or specialId.
I can only seem to add the label if i loop through all the points already rendered
Is there a way to add a label by using my Id's?
I also need to resize the graph and the labels to remain in the same place
Alternatively if this is not possible, is there anyway to add the labels as i'm adding the series?:
getchart.addSeries({
name: thisGroup,
id: CurrentGroupID,
dashStyle: 'ShortDot',
data: groupLogArray,
keys: ['x', 'y', 'specialId'],
showInNavigator: true, //this shows the series data in the small bottom navigator
point: {
events: {
click: function () {
//alert("test click");
}
}
}
});
You can add an annotation by x and y axis values:
chart.addAnnotation({
labels: [{
text: 'Alarm',
point: {
x: 2,
y: 3,
xAxis: 0,
yAxis: 0
}
}]
});
Live demo: http://jsfiddle.net/BlackLabel/k6trha3e/
API Reference: https://api.highcharts.com/class-reference/Highcharts.Chart#addAnnotation
As an alternative, you can also use data labels: http://jsfiddle.net/BlackLabel/n4586xzq/

Two splines comparison

I'm trying to display two splines (xAsis: Date, yAxis: Number) in one plot for comparision. Problem here that x axis values is totaly different from spline to spline. I need to stack them somehow. I tried to use different x axis, but splines draws one after another. Is there a way to do this using Highstock or Highcharts API?
Here is screenshot of plot with two axis
You need to use separate xAxis for the series:
xAxis: [{
type: 'datetime'
}, {
type: 'datetime'
}],
series: [{
type: 'spline',
data: [...]
}, {
xAxis: 1,
type: 'spline',
data: [...]
}]
Live demo: http://jsfiddle.net/BlackLabel/ch9Lu56s/
API Reference: https://api.highcharts.com/highcharts/series.spline.xAxis

How to get rid of highcharts series label

I have been looking at the different options to figure out how to remove the series label that are red circle in the image below.
enter image description here
Use enabled property for series label or do not use series-label.js module.
series: [{
label: {
enabled: false
},
data: [1, 2, 3]
}]
Live demo: http://jsfiddle.net/BlackLabel/jaL5zev4/

Highcharts : is it possible to make specific plots of a series transparent.

I am wondering if it is possible to make only specific points in a series transparent.
I would really appreciate your time and help. Thanks.
Update
As per your comment, you need to add connectNull in plotOption :
plotOptions: {
series: {
connectNulls:true
}
}
and set all you points with 0(zero) values with "Null"
var chart = $('#container').highcharts();
$.each(chart.series[0].data, function(i, point){
if(point.y == 0)
{
chart.series[0].data[i].update(null);
}
});
See the fiddle here
Old
If you want to set transparent color in specific bar ,pie-slice or column , you may set color and opacity as following
color: 'rgba(x,y,z, 0.4)'
xyz are RGB and opacity see below code and Fiddle here ,it has dark blue column transparent.
series: [{
name: 'Tokyo',
color: 'rgba(0,0,255, 0.4)', //this
data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0]
}
In area charts etc ,color gradient with stops can also be shown to show gradient .

How to remove space between highChart bar graph between two different category

read the comment in jsfiddle.
The space should not be there in rendered graph between blue one and green one in c1
http://www.jsfiddle.net/QnU9e/1/
In bar graph making 2 category and 3 series
series: [{
name: 'A',
data: [49.5, 71.5]
}, {
name: 'B',
data: [null, 78.8] // The space should not be there in rendered graph between blue one and green one in c1
}, {
name: 'c',
data: [30, 78.8]
}]
The only way I can find to do this is to control the bar spacing yourself by specifying X data values. Note, I set the pointPadding: 0 in the plotOptions so I could get total control.
series: [{
name: 'A',
data: [[0.075,49.5], [1,71.5]]
}, {
name: 'B',
data: [[0,null], [1.025,78.8]]// The space should not be there in rendered graph between blue one and green one in c1
}, {
name: 'c',
data: [[-0.075,30], [1.05,78.8]]
}]
Update fiddle.
Uforutnatley this options is not supported, but you can try to manipulate columns by translate() function which allows ot move SVG elements.

Resources