Scrolling using x axis scrollbar the tooltip is shown at some other place gnatt highcharts - highcharts

As soon as I scroll using x axis and hover over any bar the tooltip location comes at the end of the chart rather than above the bar.
const chart = Highcharts.ganttChart('container', {
chart: {
spacingLeft: 1,
style: {
fontFamily: ' Roboto, sans-serif;'
},
// event:{
// load: function(e){
// console.log(e)
// }
// },
scrollablePlotArea: {
scrollPositionY: 0,
opacity: 0
}
},
title: {
text: 'Gantt Chart with Navigation'
},
// chart: {
// scrollablePlotArea: {
// minWidth: 700,
// scrollPositionX: 1
// },
// events: {
// click: function(event) {
// alert (
// 'x: '+ Highcharts.dateFormat('%Y-%m-%d', event.xAxis[0].value) +', ' +
// 'y: '+ event.yAxis[0].value
// );
// }
// }
// },
yAxis: {
uniqueNames: true,
grid: {
enabled: true,
borderColor: 'rgba(0,0,0,0.3)',
borderWidth: 1
},
min: 0,
max: 6,
scrollbar:{
enabled : true
},
},
xAxis: {
currentDateIndicator: true,
grid: {
enabled: true,
borderColor: 'rgba(0,0,0,0.3)',
borderWidth: 1
}
},
// tooltip: {
// xDateFormat: '%a %b %d, %H:%M'
// },
plotOptions:{
series: {
pointWidth: 13,
dataLabels: {
enabled: true,
format: '{point.label}',
style: {
cursor: 'default',
pointerEvents: 'none'
}
},
}
},
navigator: {
enabled: true,
liveRedraw: 0,
series: {
type: 'gantt',
pointPlacement: 0.5,
pointPadding: 0.25
},
yAxis: {
min: 0,
max: 3,
reversed: true,
categories: []
}
},
scrollbar: {
enabled: true
},
rangeSelector: {
enabled: true,
selected: 5
},
series: [{
dataLabels: {
enabled: true,
style: {
textOutline: 0
}
},
// name : 'vai',
data: <?php echo $string; ?>
}],
tooltip: {
outside: true,
useHTML: true,
style :{
borderRadius: "10px 10px 10px"
},
pointFormatter: customPointFormatter
}
});

Related

I want to show tooltip on mouse hover of every coordinate in angular-highchart, it should show x and y axis value in tooltip or label

chart = new Chart({
chart: {
type: "line",
// height : 1000
// height: 55 + '%',
height: (9 / 16) * 100 + "%",
// width: 1200,
},
title: {
text: "",
},
credits: {
enabled: false,
},
legend: {
title: {
text: "OrderNumber",
style: {
fontStyle: BOLD,
},
},
layout: "vertical",
align: "right",
verticalAlign: "top",
borderWidth: 1,
floating: true,
backgroundColor: WHITE,
},
xAxis: {
startOnTick: true,
endOnTick: true,
title: {
text: this.xLabel,
style,
},
type: CTYPE,
gridLineColor: BLACK,
// min:
// this.chartData != undefined
// ? Math.log10(Math.ceil(Math.min(this.chartData.series) / 10) * 10)
// : this.xMin,
max: this.xMax,
gridLineWidth: 1,
lineColor: BLACK,
minorGridLineColor: BLACK,
lineWidth: 1,
tickLength: 20,
tickInterval: 1,
minorTickInterval: 0.1,
minorGridLineWidth: 0.5,
// animation: false,
labels: {
formatter: function () {
var raise = require("superscript-text");
let num = Math.log10(this.value as number).toPrecision(1);
let base = "10";
let final = base + raise(num.toString());
return final;
},
},
},
yAxis: {
startOnTick: true,
endOnTick: true,
title: {
text: this.yLabel,
style,
},
max: this.yMax,
min: this.yMin,
type: CTYPE,
lineColor: BLACK,
lineWidth: 1,
gridLineColor: BLACK,
minorGridLineColor: BLACK,
gridLineWidth: 1,
tickLength: 20,
tickInterval: 1,
minorTickInterval: 0.1,
minorGridLineWidth: 0.5,
labels: {
formatter: function () {
var raise = require("superscript-text");
let num = Math.log10(this.value as number);
let base = "10";
let final = base + raise(num.toString());
return final;
},
},
},
plotOptions: {
series: {
stickyTracking: false,
marker: {
enabled: false,
},
states: {
hover: {
enabled: false,
},
inactive: {
opacity: 1,
},
},
animation: false,
visible: true,
},
line: {
events: {
legendItemClick: function (event) {
this.selectedItemList.forEach((item) => {
if (event.target.options.id === item.product.index) {
item.product.toggleSlashEye = !item.product.toggleSlashEye;
let count = 0;
this.selectedItemList.forEach((item) => {
if (item.product.toggleSlashEye === false) count++;
});
if (count === this.selectedItemList.length) this.isSeriesVisible = true;
else this.isSeriesVisible = false;
}
});
}.bind(this),
},
},
// animation: false,
},
tooltip: {
enabled: true,
followPointer: true,
formatter: function () {
return `<b>x = ${this.y}</b> y = <b>${this.x} </b>`;
},
},
series: [],
});
currnet code status - currently I am showing tooltip on series only.
expected - I want to show the tooltip on the locations where the yaxis and xaxis graph lines cross.

Highcharts/Highmaps in ionic - map is not showing

Add Plugin 'angular2-highcharts'
add code in ionViewDidLoad()
var chart = Highcharts.mapChart('container', {
chart: {
map: 'custom/europe',
spacingBottom: 20
},
title: {
text: 'Europe time zones'
},
legend: {
enabled: true
},
plotOptions: {
map: {
allAreas: false,
dataLabels: {
enabled: true,
color: '#FFFFFF',
style: {
fontWeight: 'bold'
},
// Only show dataLabels for areas with high label rank
format: null,
formatter: function () {
if (this.point.properties && this.point.properties.labelrank.toString() < 5) {
return this.point.properties['iso-a2'];
}
}
},
tooltip: {
headerFormat: '',
pointFormat: '{point.name}: <b>{series.name}</b>'
}
}
},
})

Highcharts yaxis negative values error

I am using HighCharts to ploot some graph. I want my y-aixs to range between -1 to +1. When i set max=1 and min=-1 for y-axis, it does not work. Is there another way of implementing this. Below is the my code example.
$(opts.containerSelector).find('.chart-container').highcharts({
chart: {
events: {
load: loadLegendSelection
},
},
plotOptions: {
area: {
fillOpacity: 0.7
},
spline: {
marker: {
radius: 3
}
},
series: {
events: {
legendItemClick: storeLegendSelection
}
}
},
legend: {
},
loading: {
labelStyle: { "position": "relative", "top": "45%", "font-weight": "300", "color": "#29303a", "font-size": "22px" }
},
xAxis: {
gridLineDashStyle: 'dash',
gridLineColor: '#c2dce6',
gridLineWidth: 1,
min: minDate,
max: maxDate,
type: 'datetime',
labels: {
formatter: function() {
return formatTimestampTime(this.value);
}
},
events : {
afterSetExtremes : afterSetExtremes.bind(this, opts)
},
minRange: 3600 // one minute
},
yAxis: {
max: 1,
min: -1,
endOnTick: false,
gridLineDashStyle: 'dash',
gridLineColor: '#c2dce6',
gridLineWidth: 1,
labels: {
formatter: function() {
return formatMegawatts(this.value);
}
},
showFirstLabel: false,
title: ''
},
series: convertedData,
exporting: {
enabled: false
},
credits: {
enabled: false
},
tooltip: {
formatter:
function() {
return '<b>' + formatTimestampDateTimeWithSeconds(this.x) + '</b><br>' + formatMegawatts(this.y) + ' ('+ this.series.name + ')';
}
}
});
you can try setting min and max as given below.
yAxis: [{
max:1,
min: -1,
allowDecimals: false,
endOnTick: false,
gridLineWidth: 0,
labels: {
style: {
color: '#767676'
}
},
offset: -10,
title: {
text: 'Inv ' + val_qty,
"textAlign": 'top',
"rotation": 0,
x: 60,
y: yaxisVal,
style: {
color: '#767676',
fontWeight: 'bold'
}
}
}, {
allowDecimals: false,
min: 0,
endOnTick: false,
gridLineWidth: 0,
title: {
text: y2axisname,
"textAlign": 'top',
"rotation": 0,
x: -75,
y: yaxisVal,
style: {
color: '#767676',
fontWeight: 'bold'
}
},
offset: -10,
labels: {
format: '{value}',
style: {
color: '#767676'
}
},
opposite: true
}],

How to truncate value in tooltip using highcharts

I have following code:
$(function () {
$('#container').highcharts({
chart: {
type: 'spline',
zoomType: 'xy',
borderRadius: 20,
borderWidth: 2,
},
credits: {
enabled: false
},
title: {
text: 'CO2 (Latest 7-days)'
},
exporting: {
enabled: false
},
xAxis: {
type: 'datetime',
labels: {
overflow: 'justify'
},
startOnTick: true,
showFirstLabel: true,
endOnTick: true,
showLastLabel: true,
categories: dateAndTimeArray,
tickInterval: 10,
labels: {
formatter: function() {
return this.value.toString().substring(0, 6);
},
rotation: 0.1,
align: 'left',
step: 20,
enabled: true
},
style: {
fontSize: '8px'
}
},
yAxis: {
title: {
text: 'CO2'
},
labels: {
formatter: function() {
return this.value +'°'
}
}
},
legend: {
enabled: false
},
tooltip: {
// crosshairs: true,
shared: true,
},
plotOptions: {
spline: {
marker: {
radius: 4,
lineColor: '#666666',
lineWidth: 1
}
}
},
series: [{
name: "CR3000Tower",
data: chartData,
marker: {
enabled: false
}
} ]
});
});
It is producing the following output:
I want to truncate the tooltipe value after 2 decimal point. So that the tooltip value will be 414.26 instead of the long value. Any help please. Thanks.
Set valueDecimals, see docs.

Highcharts: remove 1 label from windrose chart

I have created a wind rose type chart using highcharts, and something like a label
that needs to be removed
I tried using: { lables: { enabled: false } } and also tried using
showFirstLabel and showLastLabel
But it didn't work for me :(
Here is how i created the wind rose chart:
wind_rose_chart = Highcharts.data({
table: 'roulette_windrose',
startRow: 1,
endRow: 38,
endColumn: 37,
complete: function (options) {
// Create the chart
window.chart = new Highcharts.Chart(Highcharts.merge(options, {
chart: {
renderTo: 'windrose_container',
polar: true,
type: 'column',
animation: false,
backgroundColor: '#e4e6e1',
plotBackgroundImage: "/images/gallery/windrose_roulette.png",
height: 400,
width: 350,
},
colors: ['#008403',
'#E30000','#000000','#E30000',
'#000000','#E30000','#000000',
'#E30000','#000000','#E30000',
'#000000','#000000','#E30000',
'#000000','#E30000','#000000',
'#E30000','#000000','#E30000',
'#E30000','#000000','#E30000',
'#000000','#E30000','#000000',
'#E30000','#000000','#E30000',
'#000000','#000000','#E30000',
'#000000','#E30000','#000000',
'#E30000','#000000','#E30000'],
title: {
text: 'Spots'
},
pane: {
size: '70%'
},
legend: {
enabled: false
},
xAxis: {
labels: {
enabled: false
},
showFirstLabel: false,
showLastLabel: false,
tickmarkPlacement: 'on',
lineWidth:0,
gridLineWidth: 0
},
yAxis: {
min: 0,
gridLineWidth: 0,
endOnTick: false,
showLastLabel: false,
showFirstLabel: false,
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
formatter: function() {
return this.y;
}
},
plotOptions: {
series: {
stacking: 'normal',
shadow: false,
groupPadding: 0,
pointPlacement: 'on',
}
},
navigation: {
buttonOptions: {
enabled: true
}
},
exporting: {
enabled: true
},
credits: {
enabled: false
}
}));
}
});
following code is working:
yAxis: {
...
labels: {
enabled: false
}
}
DEMO

Resources