High Charts Grid Lines Not displaying Correctly - highcharts

We have a large web application that we are using High Charts in. We use Bootstrap, Jquery and some other plugins.
The issue is that the grid lines are not showing up correctly. The application is pretty large and I cannot recreate the issue in a fiddle. I basically copy and pasted the code from a demo fiddle for testing so the code should be good.
As requested, here is the example fiddle of what I am trying to achieve: fiddle I tried to move it outside all elements except the body and still have the issue.
Here is a screenshot.
Here is the code I have on my page. i will be switching to json loading the data, but I need to get the rendering correct before I spend the time on that.
$(function ()
{
$('#ChartContainer2').highcharts({
chart: {
type: 'bar',
options3d: {
enabled: true,
alpha: 20,
beta: 20,
viewDistance: 0,
depth: 60
},
marginTop: 80,
marginRight: 40
},
title: {
text: ''
},
xAxis: {
categories: ['15-05 SFYBAKE Brooklyn Bred - Bakery Rack Display (NOR) Brooklyn Bred Rack in Bakery',
'10-10 Savemart- Lucky 5 Hour Diet HBC resets Savemart-Lucky 5 Hour Diet HBC Resets',
'11-10 SFY 5 HOUR Energy CMT Dist. Check 5 HOUR Energy CMT Dist. Check',
'10-07 SFY 5 Hour Energy Drink 5 Hour Energy Drink',
]
},
yAxis: {
allowDecimals: false,
min: 0,
title: {
text: 'Percent Complete'
}
},
tooltip: {
headerFormat: '<b>{point.key}</b><br>',
pointFormat: '<span style="color:{series.color}">\u25CF</span> {series.name}: {point.y} / {point.stackTotal}'
},
plotOptions: {
bar: {
stacking: 'normal',
depth: 10
}
},
series: [{
name: 'John',
data: [5, 3, 4],
}, {
name: 'Joe',
data: [3, 2, 1],
}, {
name: 'Jane',
data: [2, 5, 6],
}]
});

Related

How i can increase size of legends in line Highchart

How i can increase legend symbol size, I have tried these properties
symbolHeight: 12
symbolWidth: 12
symbolRadius: 6 but these are not working for line chart.
code:https://jsfiddle.net/juvcfkmh/4/
Highcharts.chart('container', {
chart: {
type: 'line'
},
title: {
text: 'Round legend symbols'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr']
},
legend: {
symbolHeight: 12,
symbolWidth: 12,
symbolRadius: 6
},
series: [{
data: [1, 3, 2, 4]
}, {
data: [6, 4, 5, 3]
}, {
data: [2, 7, 6, 5]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
The legend appearance is based on a series marker, so you can for example create another series without data, define marker options and link the real series.
series: [{
...,
id: 'firstSeries',
marker: {
radius: 15
},
data: []
}, {
...,
linkedTo: 'firstSeries',
data: [...]
}]
Live demo: http://jsfiddle.net/BlackLabel/4yrk5dq1/

Highcharts polar label textoverflow

When trying to configure a polar chart in highcharts 7.2.0 I am unable to configure the chart to always show labels on the xAxis. When the chart is not a polar chart then configuration property of xAxis.labels.styles.textOverflow = 'none' works correctly. The jsfiddle below shows that labels on the xAxis will automatically be removed if they collide with another label. I am looking to configure the polar chart to do the same thing as the line chart. When chart.polar: true is removed you can see the line chart with labels that overlap each other.
https://jsfiddle.net/y6xor7ac/3/
Highcharts.chart('container', {
chart: {
// comment this line to show line graph working correctly
polar: true
},
title: {
text: 'Highcharts Polar Chart'
},
subtitle: {
text: 'Also known as Radar Chart'
},
pane: {
startAngle: 0,
endAngle: 360
},
xAxis: {
tickInterval: 45,
min: 0,
max: 360,
overflow: 'allow',
labels: {
style: {
textOverflow: 'none'
},
format: '{value}° super long text to make it overlap super long text to make it overlap super long text to make it overlap '
}
},
yAxis: {
min: 0,
overflow: 'allow',
stackLabels: {
allowOverlap: true
}
},
plotOptions: {
series: {
pointStart: 0,
pointInterval: 45
},
column: {
pointPadding: 0,
groupPadding: 0
}
},
series: [{
type: 'column',
name: 'Column',
data: [8, 7, 6, 5, 4, 3, 2, 1],
pointPlacement: 'between'
}, {
type: 'line',
name: 'Line',
data: [1, 2, 3, 4, 5, 6, 7, 8]
}, {
type: 'area',
name: 'Area',
data: [1, 8, 2, 7, 3, 6, 4, 5]
}]
});
You can use internal allowOverlap property:
xAxis: {
...
labels: {
allowOverlap: true,
...
}
},
Live demo: https://jsfiddle.net/BlackLabel/1rkz9sfp/
API Reference: https://api.highcharts.com/highcharts/xAxis.labels

Highcharts addaxis measure dynamically

I want to add yAxis dynamically.
chart.addAxis({
id: serie.options.id,
title: {
text: serie.name
},
lineWidth: 2,
lineColor: serie.color,
opposite: false,
});
the code above, adds only line. I need to add measure too. How can i add specific measure for a serie?
For new axis to show measure (AKA scale and labels) you need to set this axis as an yAxis for a series or link this new axis to an existing one, that is showing labels.
$(function() {
$('#container').highcharts({
series: [{
data: [1, 2, 3, 4, 5, 6, 7]
}]
}, function(chart) {
chart.addAxis({
id: 'serie.options.id',
title: {
text: 'serie.name'
},
lineWidth: 2,
//lineColor: serie.color,
opposite: false,
//linkedTo: 0
});
chart.addSeries({
data: [42,2,4,0],
yAxis: 1
});
});
});
Example with:
linkedTo: http://jsfiddle.net/u90dLbc6/1/
assigned series: http://jsfiddle.net/u90dLbc6/0/

How to change color of line above or below specify curve line in Highcharts?

Is it possible to change color of line for specified range in Highcharts? I have enclosed an image which presents expected result.
I know that I can use the separated series, but it's uncomfortable. Maybe there is some wrapper (plugin) which makes this process easier.
As I far as I know, there isn't any wrapper for that. I would to this in two steps:
calculate intersection points
use two separate series or multicolor-series plugin (multiple colors within one line).
I was able to find a demo of something similar to your image that may be what you are looking for (and a lot of other good examples with JS.Fiddles and code) I found this one here which uses this code:
$(function () {
$('#container').highcharts({
chart: {
type: 'areaspline'
},
title: {
text: 'Average fruit consumption during one week'
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 150,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
xAxis: {
categories: [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'
],
plotBands: [{ // visualize the weekend
from: 4.5,
to: 6.5,
color: 'rgba(68, 170, 213, .2)'
}]
},
yAxis: {
title: {
text: 'Fruit units'
}
},
tooltip: {
shared: true,
valueSuffix: ' units'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
}
},
series: [{
name: 'John',
data: [3, 4, 3, 5, 4, 10, 12]
}, {
name: 'Jane',
data: [1, 3, 4, 3, 3, 5, 4]
}]
});
});
and has a JS.Fiddle for it here. Hope that helps.

Why I cannot display less than 6 days?

I'm trying to display some data using HighStock. Everything works quite fine beside the fact that I cannot display less than 6 days.
As you can see below, I have selected 3 days as range but the chart still shows 6 columns.
Moreover, if I try to select any day after April 18 as "from" value, the value is ignored and April 18, 2013 is considered. Finally, I have the same behavior if I try to pinch the navigator, I cannot display less than 6 days.
I have looked into HighStock API Reference but I cannot find any reference to the fact that 6 is de default number of days/values shown.
Below I report my js:
$('#container').highcharts('StockChart', {
chart: {
backgroundColor: '#E5E7EB'
},
rangeSelector: {
buttons: [{
type: 'day',
count: 3,
text: '3d'
}, {
type: 'week',
count: 1,
text: '1w'
}, {
type: 'month',
count: 1,
text: '1m'
}, {
type: 'month',
count: 3,
text: '3m'
}, {
type: 'month',
count: 6,
text: '6m'
}, {
type: 'ytd',
count: 1,
text: 'Ytd'
},{
type: 'year',
count: 1,
text: '1y'
}, {
type: 'all',
text: 'All'
}],
selected: 1
},
xAxis: {
type: 'datetime',
minTickInterval: 24 * 3600 * 1000 // daily
},
yAxis: {
offset: 8,
title: {
text: yAxisTitle
},
labels: {
align:'right'
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: false,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series: seriesOptions
});
Am I missing anything? How may I display less than 6 days/values?
Thanks and have a nice day.
You should set minRange http://api.highcharts.com/highstock#xAxis.minRange
In your example: 3 * 24 * 3600 * 1000 (which means 3 days)

Resources