Hi I try to create spider chart using high chart but it taking first 4 values(parm1,parm2,parm3,parm4) properly but not the other 4 values (data1,data2,data3,data4)
i am using this code to call these values finalResults.innerHTML += spiderChart (PM,AF,AT,AD,dataPM,dataAF,dataAT,dataAD) + "<br>" values of PM,AF,AT and AD are showing properly in spider chat but for data dataPM,dataAF,dataAT,dataAD it is showing nothing ... i check the function by replacing variable with acctual value and it was working properly... please let me know what is wrong here ?
function spiderChart(parm1,parm2,parm3,parm4,data1,data2,data3,data4) {
$('#container2').highcharts({
chart: {
polar: true,
type: 'line',
margin: 0
},
exporting: {
enabled: false,
buttons: {
enabled: false
}
},
title: {
text: ' ',
x: -80,
useHTML: true
},
pane: {
size: '70%'
},
xAxis: {
categories: [parm1,parm2,parm3,parm4],
tickmarkPlacement: 'on',
lineWidth: 0,
labels: {
align: 'center',
distance: 43
}
},
yAxis: {
gridLineInterpolation: 'polygon',
lineWidth: 0,
min: 0,
endOnTick: true,
showLastLabel: true,
tickPositions: [10, 20, 30, 40, 50, 60, 70 , 80]
},
credits: {
enabled: false
},
tooltip: {
shared: true,
headerFormat: '<span style="font-size: 12px">{point.key}:</span> <b>{point.y:,.2f}</b>',
pointFormat: '',
useHTML: true
},
legend: {
enabled: true,
align: 'right',
verticalAlign: 'top',
y: 30,
layout: 'vertical'
},
series: [{
name: 'Maturity',
data: [data1,data2,data3,data4],
pointPlacement: 'on',
color: 'green',
fillOpacity: 0.2
}]
});
};
Related
Highcharts.chart('container', {
chart: {
type: 'arearange',
zoomType: 'x',
scrollablePlotArea: {
minWidth: 600,
scrollPositionX: 1
}
},
title: {
text: 'Temperature variation by day'
},
xAxis: {
//type: 'datetime',
accessibility: {
rangeDescription: 'Range: Jan 1st 2017 to Dec 31 2017.'
}
},
yAxis: {
title: {
text: null
},
labels: {
enabled:true
}
},
legend: {
enabled: false
},
plotOptions: {
series: {
//stacking: 'normal',
borderColor: '#303030',
color : '#cac9c9',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#303030'
}
},
dataLabels: {
useHTML: true,
enabled: true,
inside: true,
align:'left',
allowDecimals: true,
formatter: function(){
return "SOME_TEXT_INSIDE_HTML_TAG";
}
},
},
series: [{
data: [
[0, 10],
[0, 10],
],
borderColor: 'black',
borderWidth: 0.2,
},
{
data: [
[20, 40],
[20, 40],
]
}]
});
Above is the code for an Area range chart. Couple of questions.
I just want to show some random text on top of each area. I tried with dataLabels but I doesn't seem to work. Isn't it possible to do so?
Yaxis seems to be shown in AreaRange chart when mouse is hovered over the chart. Can it be set to be displayed by default?
Any help would be much appreciated. Thanks in advance.
I tried to reproduce your code and here is an output: https://jsfiddle.net/BlackLabel/uqmyjsr9/
The dataLabels config needs to be nested in the series object.
plotOptions: {
series: {
//stacking: 'normal',
borderColor: '#303030',
color: '#cac9c9',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#303030'
},
dataLabels: {
useHTML: true,
enabled: true,
inside: true,
align: 'left',
allowDecimals: true,
formatter: function() {
return "SOME_TEXT_INSIDE_HTML_TAG";
}
},
},
},
I am not sure here - the yAxis is displayed all the time, not only after hovering over the chart.
I am using high charts to show energy data but i think due to some negative value high caharts starting a new line from each new point and lines not have any connection between them.
here is the picture of my results.
problem Image
you can see in the image there should be only one line.
here's my data for this.
I have 4 series's to show in graph but here i am only providing one because each line have same issue
var data={'vt':[[1588273200000, 0],[1586372400000, 245],[1586286000000, 200],[1586199600000, 7],[1586113200000, 4],[1586026800000, 1],[1585940400000, 4],[1588186800000, 40],[1585854000000, 7],[1588100400000, 30],[1588014000000, 155],[1587927600000, 38],[1587841200000, 57],[1587754800000, 35],[1587668400000, 66],[1587582000000, 68],[1587495600000, 35],[1587409200000, 40],[1587322800000, 62],[1585767600000, 8],[1587236400000, 37],[1587150000000, 44],[1587063600000, 72],[1586977200000, 13],[1586890800000, 5],[1586804400000, 58],[1586718000000, 90],[1586631600000, 41],[1586545200000, 186],[1586458800000, -498]]};
and here's how i initialize the highcharts object.
$('#'+id).highcharts({
title: {
text: titletext
},
time: {
timezone: 'Asia/Karachi'
},
chart: {
zoomType: 'x',
title: 'Meter 1'
},
xAxis: {
labels: {
formatter:function(){
return Highcharts.dateFormat("%b %e", this.value);
}
},
title: {
text: 'Date'
},
showLastLabel: true,
tickmarkPlacement: 'on',
tickPosition: 'inside',
tickWidth: 0,
tickPixelInterval: 60,
lineWidth: 2,
lineColor: 'rgba(255,205,255,0.6)',
minPadding: 0,
gridLineWidth: 0,
offset: 20,
type: 'datetime',
tickInterval: 24 * 3600 * 1000,
endOnTick: true,
},
yAxis: {
gridLineColor: 'black',
gridLineWidth: 0,
title: {
enabled: true,
text: cap
},
labels: {
enabled: true
}
},
tooltip: {
backgroundColor: 'white',
borderColor: 'black',
shadow: true,
style: {
color: 'black',
fontSize: '12px',
padding: '8px'
},
enabled: true,
crosshairs: false,
shared: false,
snap: 30,
},
plotOptions: {
flags: {
shape: 'squarepin'
}
},
series: [
{
name: 'Total kwh',
data: data.vt
},
{
name: 'Day kwh',
data: data.dt
},
{
name: 'Peak kwh',
data: data.pt
},
{
name: 'Off Peak kwh',
data: data.opt
}
],
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
y: 30,
navigation: {
enabled: true
},
adjustChartSize: true,
},
exporting: {
filename: titletext+'_'+"<?php echo $_SESSION['username']; ?>"+'_'+todayDate(),
buttons: {
contextButton: {
menuItems: ["viewFullscreen",
"separator",
"downloadJPEG",
"separator",
"downloadXLS",
]
}
}
},
credits: {
enabled: false
}
}
)
You need to provide an external graph value for z-index which will identify its position
Please go through this fiddle link with ur dataset. I have improved ur code.
So you can review it.
https://jsfiddle.net/vishalanand77/f6dnua28/32
You have unsorted data - Highcharts error #15: https://www.highcharts.com/errors/15/
You can sort it in this way:
data.vt.sort(function(a, b) {
return a[0] - b[0];
});
Live demo: http://jsfiddle.net/BlackLabel/6m4e8x0y/4993/
i getting issue create dynamic dotted graph in php data fetch data base y-axis data ploat and x-axis date required but getting issue pls give me some hint or google line
i am using this code but x-axis not display date
$(function () {
$('#container').highcharts({
chart: {
type: 'scatter',
zoomType: 'xy'
},
title: {
text: 'Height Versus Weight of 507 Individuals by Gender'
},
subtitle: {
text: 'Source: Heinz 2003'
},
xAxis: {
title: {
enabled: true,
text: 'Height (cm)'
},
startOnTick: true,
endOnTick: true,
showLastLabel: true
},
yAxis: {
title: {
text: 'Weight (kg)'
}
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 100,
y: 70,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
borderWidth: 1
},
plotOptions: {
scatter: {
marker: {
radius: 5,
states: {
hover: {
enabled: true,
lineColor: 'rgb(100,100,100)'
}
}
},
states: {
hover: {
marker: {
enabled: false
}
}
},
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x} cm, {point.y} kg'
}
}
},
series: [{
name: 'Female',
color: 'rgba(223, 83, 83, .5)',
data: [[07/07/2004, 51.6], [07/026/2004, 59.0], [08/01/2004, 49.2], [08/26/2004, 63.0]]
}]
}]
}); });
So when I have a chart that has nothing but 0 data (such as packet loss measurement) the Y axis isn't drawn unless you implicitly define a max and min value.
I have however a need for the graph to auto draw with 0 data without specifying a max as the max may not always be know (data throughput for example).
http://jsfiddle.net/fYkQy/2/ shows what I'm getting. see code attached
$(document).ready(function () {
Highcharts.setOptions({
global: {
useUTC: false
}
});
PacketLoss = new Highcharts.StockChart({
chart: {
renderTo: 'container',
defaultSeriesType: 'line',
spacingRight: 30,
spacingBottom: 45,
width: 600,
height: 400
},
rangeSelector: {
enabled: false
},
title: {
text: 'PacketLoss'
},
scrollbar: {
liveRedraw: true
},
navigator: {
adaptToUpdatedData: true
},
xAxis: {
type: 'datetime',
tickPixelInterval: 80,
maxZoom: 1440 * 1000
},
yAxis: {
minPadding: 0.2,
maxPadding: 0.2,
min: 0,
offset: 35,
title: {
text: 'PacketLoss (%)',
margin: 12
}
},
tooltip: {
valueDecimals: 2,
valueSuffix: "%"
},
plotOptions: {
line: {
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 5
}
}
},
shadow: false
}
},
legend: {
enabled: true,
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom',
x: 30,
y: 35,
floating: true,
shadow: true
},
series: [{
name: 'PacketLoss',
color: '#660000',
zIndex: 100,
data: [[1373354992000,0],[1373361195000,0],[1373363923000,0],[1373380804000,0],[1373388550000,0],[1373392475000,0],[1373399655000,0],[1373409555000,0],[1373409858000,0],[1373410160000,0],[1373410765000,0],[1373411067000,0],[1373411369000,0],[1373411670000,0],[1373411971000,0],[1373412273000,0],[1373412574000,0],[1373412875000,0],[1373413177000,0],[1373413479000,0],[1373413780000,0],[1373414082000,0],[1373414384000,0],[1373414686000,0],[1373414988000,0],[1373415289000,0],[1373415591000,0],[1373415893000,0],[1373416196000,0],[1373416497000,0],[1373416799000,0],[1373417101000,0],[1373417402000,0],[1373417704000,0],[1373418006000,0],[1373418308000,0],[1373418610000,0],[1373418911000,0],[1373419212000,0],[1373419514000,0],[1373419819000,0],[1373420120000,0],[1373420421000,0],[1373420723000,0],[1373421025000,0],[1373421326000,0],[1373421628000,0],[1373421929000,0],[1373422231000,0],[1373422532000,0],[1373422834000,0],[1373423136000,0],[1373425197000,0],[1373432327000,0]]
}]
});
});
http://jsfiddle.net/aBsqz/ shows how it looks with a set max and min (works with percentage values but not unknown values.
$(document).ready(function () {
Highcharts.setOptions({
global: {
useUTC: false
}
});
PacketLoss = new Highcharts.StockChart({
chart: {
renderTo: 'container',
defaultSeriesType: 'line',
spacingRight: 30,
spacingBottom: 45,
width: 600,
height: 400
},
rangeSelector: {
enabled: false
},
title: {
text: 'PacketLoss'
},
scrollbar: {
liveRedraw: true
},
navigator: {
adaptToUpdatedData: true
},
xAxis: {
type: 'datetime',
tickPixelInterval: 80,
maxZoom: 1440 * 1000
},
yAxis: {
minPadding: 0.2,
maxPadding: 0.2,
min: 0,
max: 100,
offset: 35,
title: {
text: 'PacketLoss (%)',
margin: 12
}
},
tooltip: {
valueDecimals: 2,
valueSuffix: "%"
},
plotOptions: {
line: {
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 5
}
}
},
shadow: false
}
},
legend: {
enabled: true,
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom',
x: 30,
y: 35,
floating: true,
shadow: true
},
series: [{
name: 'PacketLoss',
color: '#660000',
zIndex: 100,
data: [[1373354992000,0],[1373361195000,0],[1373363923000,0],[1373380804000,0],[1373388550000,0],[1373392475000,0],[1373399655000,0],[1373409555000,0],[1373409858000,0],[1373410160000,0],[1373410765000,0],[1373411067000,0],[1373411369000,0],[1373411670000,0],[1373411971000,0],[1373412273000,0],[1373412574000,0],[1373412875000,0],[1373413177000,0],[1373413479000,0],[1373413780000,0],[1373414082000,0],[1373414384000,0],[1373414686000,0],[1373414988000,0],[1373415289000,0],[1373415591000,0],[1373415893000,0],[1373416196000,0],[1373416497000,0],[1373416799000,0],[1373417101000,0],[1373417402000,0],[1373417704000,0],[1373418006000,0],[1373418308000,0],[1373418610000,0],[1373418911000,0],[1373419212000,0],[1373419514000,0],[1373419819000,0],[1373420120000,0],[1373420421000,0],[1373420723000,0],[1373421025000,0],[1373421326000,0],[1373421628000,0],[1373421929000,0],[1373422231000,0],[1373422532000,0],[1373422834000,0],[1373423136000,0],[1373425197000,0],[1373432327000,0]]
}]
});
});
Is this a bug? or am I initiating something incorrectly? Not sure whether this bug is only visible in the highstock fork.
Thanks
It looks like a problem, reported to our developers here
My highchart crashes chrome, when i add the 2nd serie.
Cannot see Chrome console to debug.. :(
Does anyone have an idea?
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
margin: [40,10,60,80],
},
title: {
text: 'Temperature Today'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%H:%M'
},
tickInterval: 3600 * 1000,
labels: {
rotation: -45,
align: 'right',
style: {
fontSize: '10px',
fontFamily: 'Verdana, sans-serif'
}
},
},
yAxis: {
title: {
text: 'Temperature'
},
minorGridLineWidth: 0,
/* gridLineWidth: 0, */
/* alternateGridColor: null */
},
tooltip: {
formatter: function() {
return ''+
Highcharts.dateFormat('%H:%M', this.x) +': '+ this.y;
}
},
plotOptions: {
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 3
}
},
marker: {
enabled: false,
states: {
hover: {
enabled: true,
symbol: 'circle',
radius: 3,
lineWidth: 1
}
}
},
}
},
series: [{
name: 'Temperature',
data: temp,
type: 'line',
showInLegend: false,
pointInterval: 60 * 1000,
pointStart: Date.UTC(2006, 0, 1),
marker: {
enabled: false
},
dashStyle: 'solid',
yAxis: 0,
xAxis: 0,
} , {
name: 'Humdity',
data: hum,
yAxis: 1,
xAxis: 0,
showInLegend: false,
type: 'line',
}],
navigation: {
menuItemStyle: {
fontSize: '6px'
}
}
});
});
});
You only have one yAxis, so it breaks because you set the second serie to display into the second one( yes, that's what yAxis: 1 means ).
Remove it or create the second yAxis.
Update:
Use yAxis: 0 the reffer the first and 1 to the second.
Missing , after } on line 36 of jsfiddle.
Store data before.
Demo