highcharts: disable hover on column chart when i use two chart togheder - highcharts

Before the hover in the empty space
After the hover in the empty space
It consists of two simultaneous charts.
As I move the mouse over the empty space, the bottom chart becomes faint. I want nothing to happen in hover.
I searched the internet a lot for inactive and hover to false, and ... but none.
This is my chart info:
Highcharts.chart('stock-trading-process', {
title: {
text: ''
},
tooltip: {
enabled: false
},
xAxis: {
labels: {
enabled: false
},
visible: false
},
chart: {
backgroundColor: 'gray',
margin: [0, 0, 0, 0]
},
yAxis: [{
gridLineWidth: 0,
title: {
text: ''
},
labels: {
enabled: false
},
height: '50%',
lineWidth: 2,
}, {
gridLineWidth: 0,
labels: {
enabled: false
},
title: {
text: ''
},
top: '50%',
height: '50%',
offset: 0,
lineWidth: 2
}],
series: [{
type: 'line',
showInLegend: false,
color: '#00B1FC',
data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 3, 2, 4, 6, 3, 1, 1],
marker: {
enabled: false,
states: {
hover: {
enabled: false
},
inactive: {
opacity: 1
}
}
},
states: { hover: 'none' },
fillColor: '#F7F8FA'
}, {
type: 'column',
color: '#94E3FD',
pointWidth: 1,
showInLegend: false,
marker: {
enabled: true,
states: {
hover: {
enabled: true
},
inactive: {
opacity: 1
}
}
},
data: [1, 8, 6, 7, 4, 5, 9, 3, 2, 1, 7, 8, 5, 1, 2, 5, 9],
yAxis: 1,
states: { hover: 'none' }
}],
exporting: {
enabled: true
},
credits: {
enabled: false
},
navigation: {
buttonOptions: {
enabled: false
}
}
});

As I understood - setting the states.inactive.opacity to 1 on the series object is the solution which you are looking for.
states: {
inactive: {
opacity: 1
}
},
Demo: https://jsfiddle.net/BlackLabel/en5j4v31/
API: https://api.highcharts.com/highcharts/series.line.states.inactive.opacity
Am I right? If not, could you describe more precisely what do you have in mind?

Why doesn't it work for me?
Demo: https://jsfiddle.net/3uzfqs4m/
{
yAxis: [{
visible: false,
gridLineWidth: 0,
title: {
text: ''
},
labels: {
enabled: false
},
height: '50%',
lineWidth: 2,
}, {
visible: false,
gridLineWidth: 0,
labels: {
enabled: false
},
title: {
text: ''
},
top: '50%',
height: '50%',
offset: 0,
lineWidth: 2
}],
series: [{
type: 'line',
showInLegend: false,
color: '#00B1FC',
data: [50, 15, 8, 25, 84, 74, 26, 54, 29, 35, 9, 15, 17, 18, 54, 26, 34, 27, 26, 18, 57, 24, 35, 16, 24, 25, 27],
marker: {
enabled: false,
states: {
hover: {
enabled: false
},
inactive: {
opacity: 1
}
}
},
states: {
inactive: {
opacity: 1
}
},
states: { hover: 'none' },
fillColor: '#F7F8FA'
}, {
type: 'column',
color: '#94E3FD',
pointWidth: 1,
showInLegend: false,
marker: {
enabled: true,
states: {
hover: {
enabled: true
},
inactive: {
opacity: 1
}
}
},
states: {
inactive: {
opacity: 1
}
},
data: [50, 15, 8, 25, 84, 74, 26, 54, 29, 35, 9, 15, 17, 18, 54, 26, 34, 27, 26, 18, 57, 24, 35, 16, 24, 25, 27],
yAxis: 1,
states: { hover: 'none' }
}],
chart: {
backgroundColor: '#F4F7FA',
margin: [0, -5, 0, -5]
},
title: {
text: ''
},
tooltip: {
enabled: false
},
xAxis: {
labels: {
enabled: false
},
visible: false
},
exporting: {
enabled: true
},
credits: {
enabled: false
},
navigation: {
buttonOptions: {
enabled: false
}
}
}

Related

Highcharts. Indentation and formatting issues

I want to make the graph start at 0 (as shown in the picture) and have the string formatted according to the regular expression replace(/\B(?=(\d{3})+(?!\d))/g, " ") but all my attempts are unsuccessful.
chartOptions: {
colors: ['#3DC3FB', '#FF5252', '#D2F449', '#179877'],
title: {
text: "",
},
credits: {
enabled: false
},
tooltip: {
formatter: function () {
if (this.x > 0) {
return this.x;
} else return false;
},
},
plotOptions: {
series: {
enableMouseTracking: false,
states: {
hover: {
enabled: false
},
normal: {
animation: false
},
select: {
enabled: false
}
}
},
},
xAxis: {
gridLineWidth: 1,
tickmarkPlacement: 'on',
lineColor: "#A4A4A4",
min: 0,
categories: [null, "10 лет"],
top: 10,
right: -100,
title: {
style: {
color: "#A4A4A4"
}
},
},
yAxis: {
gridLineWidth: 0,
tickColor: 'undefined',
tickLength: 5,
tickWidth: 1,
tickPosition: 'outside',
lineWidth: 1,
lineColor: '#A4A4A4',
min: 3,
title: {
text: "Доход от инвестиций",
margin: 10,
align: "low",
style: {
color: "#A4A4A4"
},
y: -50,
},
labels: {
enabled: false,
},
},
legend: {enabled: false},
marker: {
enabled: false,
symbol: 'circle',
radius: 12,
states: {
hover: {
fillColor: 'white',
lineColor: 'green',
lineWidth: 0
}
}
},
series: [
{
type: 'line',
name: "ВДело",
data: [0, 1100],
dataLabels: {
x: -100,
y: 5,
enabled: true,
// useHTML: true,
format: `{point.y}/мес`,
formatter: function () {
return Highcharts.numberFormat(this.y,2);
},
color: "#3DC3FB",
style:{
fontSize: 20,
lineHeight: 18,
fontWeight: 500,
fontFamily: 'Gilroy',
fontStyle: 'normal',
}
},
animation: {
defer: 1
},
marker: {
symbol: 'circle',
radius: 4,
states: {
hover: {
fillColor: '#3DC3FB',
lineColor: 'green',
lineWidth: 0
}
}
},
},
{
type: 'line',
name: "Акции",
data: [0, 550],
animation: {
defer: 1
},
marker: {
symbol: 'circle',
radius: 4,
states: {
hover: {
fillColor: '#FF5252',
lineColor: 'green',
lineWidth: 0
}
}
},
},
{
type: 'line',
name: "Облигации",
data: [0, 366],
animation: {
defer: 1
},
marker: {
symbol: 'circle',
radius: 4,
states: {
hover: {
fillColor: '#D2F449',
lineColor: 'green',
lineWidth: 0
}
}
},
},
{
type: 'line',
name: "Депозит",
data: [0, 275],
animation: {
defer: 1
},
marker: {
symbol: 'circle',
radius: 4,
states: {
hover: {
fillColor: '#179877',
lineColor: 'green',
lineWidth: 0
}
}
},
},
],
},
I am new to highcharts and have a hard time with huge documentation. help me please
Understood the cost of his sleep. For those who will be interested. So that the graph starts like in the picture.
plotOptions: {
series: {
findNearestPointBy: 'x',
label: {
connectorAllowed: false
},
pointPlacement: 'on'
}
}
and
{
type: 'line',
name: "ВДело",
data: [0, 1100],
dataLabels: {
x: -50,
y: -10,
enabled: true,
format: `{point.y}/мес`,
pointFormat: ' <b>{point.y:,.0f}/мес</b>',
shared: true,
color: "#3DC3FB",
style:{
fontSize: 20,
lineHeight: 18,
fontWeight: 500,
fontFamily: 'Gilroy',
fontStyle: 'normal',
}
},
When it comes to the place to start the chart in the category axis, you need to only change xAxis.min to 0.5
Sample code:
xAxis: {
min: 0.5,
tickmarkPlacement: 'on',
type: 'category'
},
Simplified demo:
https://jsfiddle.net/BlackLabel/jt1gqrnb/

Highcharts - How do I keep both line points in from splitting between the two bar charts

How do I keep both line points/markers in from splitting between the two bar charts but yet still have the ability to span both when values exceed initial bar value.
In the following example you will note that there are two line series that have the same values and thus I'm wanting the points/markers positioned one above the other but they are being split between the two stacked bars.
If you comment out the first bar series and plot options (see comments in code) you will see what I looking achieve but want the stacked bars rendered as well as have the second data value shown to the left.
My fiddle: https://jsfiddle.net/gbp5qvzh/58
var mychart = Highcharts.chart(
'container', {
chart: {
type: 'bar',
height: '400px'
},
title: {
text: null
},
xAxis: {
lineWidth: 0,
tickLength: 0,
opposite: false,
labels: {
enabled: false
}
},
yAxis: {
opposite: true,
gridLineWidth: 0,
title: {
enabled: false
},
labels: {
enabled: false
},
stackLabels: {
enabled: false,
formatter: function () {
return '<div class="barLabel">' + this.axis.chart.xAxis[0].categories[this.x] + '</div>';
},
useHTML: true,
verticalAlign: 'top',
align: 'left',
style: {
fontSize: '16px',
fontFamily: 'proxima-nova'
}
}
},
tooltip: {
enabled: false
},
legend: {
itemStyle: {
color: '#000000',
fontWeight: 'bold',
fontSize: '18px',
fontFamily: 'proxima-nova'
}
},
series: [
/** COMMENT 1 - START **/
{ type: 'bar',
name: 'background fller',
pointWidth: 50,
data: [6, 5, 7, 3, 6],
showInLegend: false,
animation: false,
color: '#dde8f2',
dataLabels: {
enabled: false
},
states: {
hover: {
enabled: false
}
}
},
/** COMMENT 1 - END **/
{ type: 'bar',
name: 'actual value',
pointWidth: 50,
data: [4, 5, 3, 7, 4],
showInLegend: false,
color: '#729bc3',
dataLabels: {
enabled: true,
align: 'left',
style: {
textOutline: false,
color: '#000000',
fontWeight: 'bold',
fontSize: '16px',
fontFamily: 'proxima-nova'
},
},
states: {
hover: {
enabled: false
}
}
}
],
/** COMMENT 2 - START **/
plotOptions: {
series: {
stacking: 'normal',
dataLabels: {
enabled: false
},
events: {
legendItemClick: function (e) {
e.preventDefault();
}
}
}
}
/** COMMENT 2 - END **/
});
mychart.addSeries({ type: 'line', name: 'Indicator1', lineWidth: 0,
data: [3.3, 2, 3, 6, 3], pointPlacement: 0.3, showInLegend: true,
dataLabels: { enabled: true, allowOverlap: true, verticalAlign: 'top', align: 'right', color: '#ff0000', style: { textOutline: false } },
marker: { symbol: 'circle', fillColor: '#ff0000' },
states: { hover: { enabled: false }, }
});
mychart.addSeries({ type: 'line', name: 'Indicator2', data: [3.3, 2, 3, 6, 3], pointPlacement: -0.3, showInLegend: true, dataLabels: { enabled: true, allowOverlap: true, verticalAlign: 'bottom', align: 'right', style: { textOutline: false }, x: 0, y: 0 }, lineWidth: 0, marker: { symbol: 'diamond', fillColor: '#000000' }, states: { hover: { enabled: false }, }
});
Currently you have both indicators in one stack group which makes the values in second indicator to add up with first one. If you want them to look like the second images in your question You should seperate their groups using stack: value option in their series. somthing like this: (note stack: 0 in indicator1 and stack: 1 in indicator2)
mychart.addSeries({ type: 'line', name: 'Indicator1', lineWidth: 0,
data: [3.3, 2, 3, 6, 3], stack : 0, pointPlacement: 0.3, showInLegend: true,
dataLabels: { enabled: true, allowOverlap: true, verticalAlign: 'top', align: 'right', color: '#ff0000', style: { textOutline: false } },
marker: { symbol: 'circle', fillColor: '#ff0000' },
states: { hover: { enabled: false }, }
});
mychart.addSeries({ type: 'line', name: 'Indicator2', data: [3.3, 2, 3, 6,
3],stack:1, pointPlacement: -0.3, showInLegend: true, dataLabels: { enabled: true,
allowOverlap: true, verticalAlign: 'bottom', align: 'right', style: { textOutline:
false }, x: 0, y: 0 }, lineWidth: 0, marker: { symbol: 'diamond', fillColor:
'#000000' }, states: { hover: { enabled: false }, }
JSFiddle: https://jsfiddle.net/3pfm8Laz/
API Reference: https://api.highcharts.com/highcharts/series.line.stack

Highcharts bug - label formatter function does not fire with multiple axis

I have a chart with multiple yAxis and I want to format each one differently. However, it seems with multiple yAxis, the label formatter function does not fire at all. Here's my options:
{
chart: {
backgroundColor: 'transparent',
pinchType: 'none',
height: 320,
events: {
load: (e) => {
}
}
},
plotOptions: {
line: {
states: {
hover: {
enabled: true
}
},
animation: {
duration: 750
}
},
series: {
lineWidth: 2,
}
},
series : [
{ name: 'charts',
type: 'line',
id: 0,
dataGrouping: {
groupPixelWidth: 8
},
},
{ name: 'marketcap',
type: 'line',
id: 1,
color: '#1fd3a3',
dataGrouping: {
groupPixelWidth: 8
},
},
{ name: 'volume',
type: 'area',
id: 2,
color: '#ddd',
lineWidth: 1,
dataGrouping: {
groupPixelWidth: 8
},
}
],
navigator: {
enabled: false
},
scrollbar: {
enabled: false
},
rangeSelector: {
enabled: false
},
// responsive: {
// rules: [{
// condition: {
// maxWidth: 500
// },
// }]
// },
xAxis: {
// crosshair: {
// width: 1,
// color: 'rgba(255,255,255,.5)'
// },
visible: true,
type: 'datetime'
},
yAxis: [
{
opposite: false,
gridLineWidth: 0,
minorGridLineWidth: 0,
height: '75%',
tickAmount: 5,
labels: {
formatter: () => {
// this does not fire
console.log('firing!!');
return this.value
}
}
},
{
opposite: true,
gridLineWidth: 0,
minorGridLineWidth: 0,
height: '75%',
tickAmount: 5
},
{
top: '75%',
height: '25%',
opposite: false,
gridLineWidth: 0,
minorGridLineWidth: 0,
visible: false,
},
],
tooltip: {
followPointer: true,
shared: true,
},
credits: { enabled: false }
}
Notice that I have 3 yAxis, and within each of those I have different keys and values. I need to have a custom format for each, but when I try to use the formatter function, nothing happens. Using the format string value works, but it does not allow me to format the string the way I want. Any ideas?

HighCharts - 2nd yAxis graphs not scaling correctly

i'm having a problem with my second yAxis using HighCharts. The spline graph scales correctly, however the bar graph (second yAxis) does not. Note that the bar graph has two sections - the irrelevant section is invisible.
http://jsfiddle.net/warricksmith/jqvxf30z/1/
$(function () {
$('#container').highcharts({
chart: {
alignTicks: false,
backgroundColor: null,
spacingBottom: 6,
spacingLeft: 2,
spacingRight: 2,
spacingTop: 2
},
credits: {
enabled: false
},
global: {
useUTC: false
},
legend: {
align: "center",
enabled: true,
layout: "horizontal",
verticalAlign: "bottom",
y: 5
},
navigator: {
enabled: false,
height: 40,
series: {
color: "#21B567"
}
},
plotoptions: {
column: {
borderwidth: 0
},
line: {
lineWidth: 1,
marker: {
enabled: false
}
},
series: {
pointInterval: null,
pointStart: null
},
spline: {
lineWidth: 2,
marker: {
enabled: true
}
}
},
rangeselector: {
enabled: false
},
scrollbar: {
enabled: false
},
series: [{
name: 'Peak Demand',
stacking: null,
title: 'kVA',
type: 'spline',
color: "#FF6F34",
data: [821,
794,
737,
748,
778,
794,
889,
831,
819,
821,
821,
877],
tooltip: {
valueSuffix: 'kVA'
}
}, {
name: "Power at peak",
stacking: null,
title: "kVA",
tooltip: {
valueSuffix: " kVA"
},
type: "spline",
color: "#33BAE3",
data: [788,
770,
722,
733,
747,
755,
747,
814,
803,
804,
805,
737]
}, {
color: "#339A63",
data: [
0.04,
0.03,
0.02,
0.02,
0.04,
0.05,
0.16,
0.02,
0.02,
0.02,
0.02,
0.16],
name: "Power factor (lagging)",
stacking: 'normal',
title: "",
tooltip: {
valueSuffix: " "
},
type: "column",
yAxis: 1
}, {
color: "rgba(245,241,232,0)",
data: [
0.96,
0.97,
0.98,
0.98,
0.96,
0.95,
0.84,
0.98,
0.98,
0.98,
0.98,
0.84, ],
name: "Power factor (leading)",
stacking: "normal",
title: "",
tooltip: {
valueSuffix: " "
},
type: "column",
yAxis: 1
}, ],
title: {
text: 'Peak Demand and Power factor'
},
subtitle: {
text: 'Power-Star'
},
xAxis: [{
categories: ['Mar 14', 'Apr 14', 'May 14', 'Jun 14',
'Jul 14', 'Aug 14', 'Sep 14', 'Oct 14', 'Nov 14', 'Dec 14', 'Jan 15', 'Feb 15'],
lables: {
style: {
fontSize: "12px",
fontWeight: "bold"
}
},
tickPixelInterval: 150,
tickPosition: "inside",
type: "category"
}],
yAxis: [{ // Primary yAxis
gridLineWidth: 1,
index: 0,
labels: {
style: Object,
y: 10
},
max: undefined,
maxPadding: null,
min: undefined,
opposite: false,
title: {
text: "kVA"
}
}, {
gridLineWidth: 0,
index: 1,
labels: {
enabled: false
},
max: undefined,
maxPadding: null,
min: undefined,
opposite: false,
showLastLabel: false,
title: {
text: ""
}
}, {
gridLineWidth: 0,
index: 2,
labels: {
y: 10
},
max: 1,
maxPadding: 0,
min: 0.8,
opposite: true,
title: {
text: ""
}
}, {
gridLineWidth: 0,
index: 3,
labels: {
enabled: false
},
max: "1",
maxPadding: 0,
min: 0.8,
opposite: true,
showLastLabel: false,
title: {
text: ""
}
}, {
gridLineWidth: 0,
index: 4,
labels: {
enabled: false
},
max: "1",
maxPadding: 0,
min: 0.8,
opposite: true,
showLastLabel: false,
title: {
text: ""
}
}],
tooltip: {
shared: true
},
});
});
The problem is that you have so many yAxes that you made a mistake. You are connecting series to yAxis: 1 which means second yAxis in the options. Meanwhile you are setting min and max for third, fourth and fifth yAxes and enabling labels only for the third one..
Fixed demo: http://jsfiddle.net/jqvxf30z/2/
I set yAxis: 2 for series, since that yAxis is most probably responsible for columns.

highcharts start from hinges base

Is it possible to start the line from the hinges base ?
I have looked everywhere and couldnt find a solution for it
here is my code
jQuery('#chart').highcharts({
colors: ['#f5781e', '#7b3186'],
navigation: {
buttonOptions: {
enabled: false
}
},
credits: {
enabled: false
},
chart: {
type: 'line',
marginRight: 0,
marginBottom: 35,
width: 700,
height: 280,
},
title: {
text: '',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
categories: ['1','2','3','4','5','6','7','8'],
alternateGridColor: '#f4f6f5',
lineColor: '#000000',
lineWidth: 1,
min: 0,
},
yAxis: {
title: {
text: ''
},
labels: {
useHTML : true,
format: '<span class="axis"><span class="flright">{value}</span>אלף</span>'
},
tickInterval: 3,
max: 35.2,
plotLines: [{
value: 1,
width: 1,
color: '#000'
}],
lineColor: '#000000',
lineWidth: 1,
min: 0
},
plotOptions: {
series: {
pointStart: 0
}
},
tooltip: {
crosshairs: {
width: 2,
color: 'gray',
dashStyle: 'shortdot'
},
animation: true,
valueSuffix: ',000₪',
backgroundColor: 'rgba(255, 255, 255, 0.8)',
formatter: function() {return '<b>₪' + this.x + this.y +'</b>';}
},
legend: {
enabled: false
/*****************
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom',
borderWidth: 0,
floating: true,
rtl: true,
y: 15,
margin: 10,
useHTML: true,
itemStyle: {
fontFamily: 'Arial, Helvetica, sans-serif',
fontWeight: 'bold'
}
*******************/
},
series: [
{
name: 'b',
data: [0.5,1,1.5,2,2.5,3,3.5,4]
},
{
name: '<span class="abc">a</span>',
data: [4,8,12,16,20,24,28,32]
}
]
},function(chart) { //LOGO
chart.renderer.image('/images/small_logo.png', 670, 18, 31, 23).add();
}
);
here is an image of what i want to achieve
You just have to change you min value :
xAxis: {
...
min: 0.5,
...
},
Look at this : http://jsfiddle.net/yKHsD/
EDIT :
There is a better solution. It is caused by the categories option. You can avoid this problem by doing :
var xCategories = ['1','2','3','4','5','6','7','8'];
// ...
xAxis: {
....
tickmarkPlacement: 'on',
labels: {
formatter: function() {
return xCategories[this.value];
}
},
startOnTick: false,
endOnTick: false,
minPadding: 0,
maxPadding: 0,
gridLineWidth: 1
},
In this example, don't forget to remove the categories option. Here is an example : http://jsfiddle.net/yKHsD/1/

Resources