I want to build and display a time serie chart with n columns by date but some series are not visible.
Here is the chart :
How can see the 4 series without zoom in ? Only 2 are displayed.
When I click on a serie to set it visible/unvisible it hides or display one of previous unvisible serie.
What if I want to display 10 or more series ?
I tried to make the div scrollable and set a width to the chart but it doesn't work either.
Highcharts.chart('container', {
chart: {
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b'
},
},
yAxis: {
min: 0
},
plotOptions: {
series: {
}
},
series: [{
name: "1",
type:'column',
data: [
[Date.UTC(1970, 9, 15), 0.5],
[Date.UTC(1970, 9, 31), 0.5],
[Date.UTC(1970, 10, 7), 0.5],
[Date.UTC(1970, 10, 10), 0.5],
[Date.UTC(1970, 11, 10), 0.5],
[Date.UTC(1970, 11, 13), 0.5],
[Date.UTC(1970, 11, 16), 0.5],
[Date.UTC(1970, 11, 19), 0.5],
[Date.UTC(1970, 11, 22), 0.5],
[Date.UTC(1970, 11, 25), 0.5],
[Date.UTC(1970, 11, 28), 0.5],
[Date.UTC(1971, 0, 16), 0.5],
[Date.UTC(1971, 0, 19), 0.5],
[Date.UTC(1971, 0, 22), 0.5],
[Date.UTC(1971, 0, 25), 0.5],
[Date.UTC(1971, 0, 28), 0.5],
[Date.UTC(1971, 0, 31), 0.5],
[Date.UTC(1971, 1, 4), 0.5],
[Date.UTC(1971, 1, 7), 0.5],
[Date.UTC(1971, 1, 10), 0.5],
[Date.UTC(1971, 1, 13), 0.5],
[Date.UTC(1971, 1, 16), 0.5],
[Date.UTC(1971, 1, 19), 0.5],
[Date.UTC(1971, 1, 22), 0.5],
[Date.UTC(1971, 1, 25), 0.5],
[Date.UTC(1971, 1, 28), 0.5],
[Date.UTC(1971, 2, 4), 0.5],
[Date.UTC(1971, 2, 7), 0.5],
[Date.UTC(1971, 2, 10), 0.5],
[Date.UTC(1971, 2, 13), 0.5],
[Date.UTC(1971, 2, 16), 0.5],
[Date.UTC(1971, 2, 19), 0.5],
[Date.UTC(1971, 2, 22), 0.5],
[Date.UTC(1971, 2, 25), 0.5],
[Date.UTC(1971, 2, 27), 0.5],
[Date.UTC(1971, 2, 30), 0.5],
[Date.UTC(1971, 3, 3), 0.5],
[Date.UTC(1971, 3, 6), 0.5],
[Date.UTC(1971, 3, 9), 0.5],
[Date.UTC(1971, 3, 12), 0.5],
[Date.UTC(1971, 3, 15), 0.5],
[Date.UTC(1971, 3, 18), 0.5],
[Date.UTC(1971, 3, 21), 0.5],
[Date.UTC(1971, 3, 24), 0.5],
[Date.UTC(1971, 3, 27), 0.5],
[Date.UTC(1971, 3, 30), 0.5],
[Date.UTC(1971, 4, 3), 0.5],
[Date.UTC(1971, 4, 6), 0.5],
[Date.UTC(1971, 4, 9), 0.5],
[Date.UTC(1971, 4, 12), 0.5],
[Date.UTC(1971, 4, 15), 0.5],
[Date.UTC(1971, 4, 18), 0.5],
[Date.UTC(1971, 4, 21), 0.5],
[Date.UTC(1971, 4, 25), 0.5]
]
}, {
name: "2",
type:'column',
data: [
[Date.UTC(1970, 9, 15), 1],
[Date.UTC(1970, 9, 31), 1],
[Date.UTC(1970, 10, 7),1],
[Date.UTC(1970, 10, 10), 1],
[Date.UTC(1970, 11, 10), 1],
[Date.UTC(1970, 11, 13), 1],
[Date.UTC(1970, 11, 16), 1],
[Date.UTC(1970, 11, 19), 1],
[Date.UTC(1970, 11, 22), 1],
[Date.UTC(1970, 11, 25), 1],
[Date.UTC(1970, 11, 28), 1],
[Date.UTC(1971, 0, 16), 1],
[Date.UTC(1971, 0, 19), 1],
[Date.UTC(1971, 0, 22), 1],
[Date.UTC(1971, 0, 25), 1],
[Date.UTC(1971, 0, 28), 1],
[Date.UTC(1971, 0, 31), 1],
[Date.UTC(1971, 1, 4), 1],
[Date.UTC(1971, 1, 7), 1],
[Date.UTC(1971, 1, 10), 1],
[Date.UTC(1971, 1, 13), 1],
[Date.UTC(1971, 1, 16), 1],
[Date.UTC(1971, 1, 19), 1],
[Date.UTC(1971, 1, 22), 1],
[Date.UTC(1971, 1, 25), 1],
[Date.UTC(1971, 1, 28), 1],
[Date.UTC(1971, 2, 4), 1],
[Date.UTC(1971, 2, 7), 1],
[Date.UTC(1971, 2, 10), 1],
[Date.UTC(1971, 2, 13), 1],
[Date.UTC(1971, 2, 16), 1],
[Date.UTC(1971, 2, 19), 1],
[Date.UTC(1971, 2, 22), 1],
[Date.UTC(1971, 2, 25), 1],
[Date.UTC(1971, 2, 27), 1],
[Date.UTC(1971, 2, 30), 1],
[Date.UTC(1971, 3, 3), 1],
[Date.UTC(1971, 3, 6), 1],
[Date.UTC(1971, 3, 9), 1],
[Date.UTC(1971, 3, 12), 1],
[Date.UTC(1971, 3, 15), 1],
[Date.UTC(1971, 3, 18), 1],
[Date.UTC(1971, 3, 21), 1],
[Date.UTC(1971, 3, 24), 1],
[Date.UTC(1971, 3, 27), 1],
[Date.UTC(1971, 3, 30), 1],
[Date.UTC(1971, 4, 3), 1],
[Date.UTC(1971, 4, 6), 1],
[Date.UTC(1971, 4, 9), 1],
[Date.UTC(1971, 4, 12), 1],
[Date.UTC(1971, 4, 15), 1],
[Date.UTC(1971, 4, 18), 1],
[Date.UTC(1971, 4, 21), 1],
[Date.UTC(1971, 4, 25), 1]
]
}, {
name: "3",
type:'column',
data: [
[Date.UTC(1970, 9, 15), 1.5],
[Date.UTC(1970, 9, 31), 1.5],
[Date.UTC(1970, 10, 7), 1.5],
[Date.UTC(1970, 10, 10), 1.5],
[Date.UTC(1970, 11, 10), 1.5],
[Date.UTC(1970, 11, 13), 1.5],
[Date.UTC(1970, 11, 16), 1.5],
[Date.UTC(1970, 11, 19), 1.5],
[Date.UTC(1970, 11, 22), 1.5],
[Date.UTC(1970, 11, 25), 1.5],
[Date.UTC(1970, 11, 28), 1.5],
[Date.UTC(1971, 0, 16), 1.5],
[Date.UTC(1971, 0, 19), 1.5],
[Date.UTC(1971, 0, 22), 1.5],
[Date.UTC(1971, 0, 25), 1.5],
[Date.UTC(1971, 0, 28), 1.5],
[Date.UTC(1971, 0, 31), 1.5],
[Date.UTC(1971, 1, 4), 1.5],
[Date.UTC(1971, 1, 7), 1.5],
[Date.UTC(1971, 1, 10), 1.5],
[Date.UTC(1971, 1, 13), 1.5],
[Date.UTC(1971, 1, 16), 1.5],
[Date.UTC(1971, 1, 19), 1.5],
[Date.UTC(1971, 1, 22), 1.5],
[Date.UTC(1971, 1, 25), 1.5],
[Date.UTC(1971, 1, 28), 1.5],
[Date.UTC(1971, 2, 4), 1.5],
[Date.UTC(1971, 2, 7), 1.5],
[Date.UTC(1971, 2, 10), 1.5],
[Date.UTC(1971, 2, 13), 1.5],
[Date.UTC(1971, 2, 16), 1.5],
[Date.UTC(1971, 2, 19), 1.5],
[Date.UTC(1971, 2, 22), 1.5],
[Date.UTC(1971, 2, 25), 1.5],
[Date.UTC(1971, 2, 27), 1.5],
[Date.UTC(1971, 2, 30), 1.5],
[Date.UTC(1971, 3, 3), 1.5],
[Date.UTC(1971, 3, 6), 1.5],
[Date.UTC(1971, 3, 9), 1.5],
[Date.UTC(1971, 3, 12), 1.5],
[Date.UTC(1971, 3, 15), 1.5],
[Date.UTC(1971, 3, 18), 1.5],
[Date.UTC(1971, 3, 21), 1.5],
[Date.UTC(1971, 3, 24), 1.5],
[Date.UTC(1971, 3, 27), 1.5],
[Date.UTC(1971, 3, 30), 1.5],
[Date.UTC(1971, 4, 3), 1.5],
[Date.UTC(1971, 4, 6), 1.5],
[Date.UTC(1971, 4, 9), 1.5],
[Date.UTC(1971, 4, 12), 1.5],
[Date.UTC(1971, 4, 15), 1.5],
[Date.UTC(1971, 4, 18), 1.5],
[Date.UTC(1971, 4, 21), 1.5],
[Date.UTC(1971, 4, 25), 1.5]
]
},
{
name: "4",
type:'column',
data: [
[Date.UTC(1970, 9, 15), 0],
[Date.UTC(1970, 9, 31), 0.09],
[Date.UTC(1970, 10, 7), 0.17],
[Date.UTC(1970, 10, 10), 0.1],
[Date.UTC(1970, 11, 10), 0.1],
[Date.UTC(1970, 11, 13), 0.1],
[Date.UTC(1970, 11, 16), 0.11],
[Date.UTC(1970, 11, 19), 0.11],
[Date.UTC(1970, 11, 22), 0.08],
[Date.UTC(1970, 11, 25), 0.23],
[Date.UTC(1970, 11, 28), 0.37],
[Date.UTC(1971, 0, 16), 0.68],
[Date.UTC(1971, 0, 19), 0.55],
[Date.UTC(1971, 0, 22), 0.4],
[Date.UTC(1971, 0, 25), 0.4],
[Date.UTC(1971, 0, 28), 0.37],
[Date.UTC(1971, 0, 31), 0.43],
[Date.UTC(1971, 1, 4), 0.42],
[Date.UTC(1971, 1, 7), 0.39],
[Date.UTC(1971, 1, 10), 0.39],
[Date.UTC(1971, 1, 13), 0.39],
[Date.UTC(1971, 1, 16), 0.39],
[Date.UTC(1971, 1, 19), 0.35],
[Date.UTC(1971, 1, 22), 0.45],
[Date.UTC(1971, 1, 25), 0.62],
[Date.UTC(1971, 1, 28), 0.68],
[Date.UTC(1971, 2, 4), 0.68],
[Date.UTC(1971, 2, 7), 0.65],
[Date.UTC(1971, 2, 10), 0.65],
[Date.UTC(1971, 2, 13), 0.75],
[Date.UTC(1971, 2, 16), 0.86],
[Date.UTC(1971, 2, 19), 1.14],
[Date.UTC(1971, 2, 22), 1.2],
[Date.UTC(1971, 2, 25), 1.27],
[Date.UTC(1971, 2, 27), 1.12],
[Date.UTC(1971, 2, 30), 0.98],
[Date.UTC(1971, 3, 3), 0.85],
[Date.UTC(1971, 3, 6), 1.04],
[Date.UTC(1971, 3, 9), 0.92],
[Date.UTC(1971, 3, 12), 0.96],
[Date.UTC(1971, 3, 15), 0.94],
[Date.UTC(1971, 3, 18), 0.99],
[Date.UTC(1971, 3, 21), 0.96],
[Date.UTC(1971, 3, 24), 1.15],
[Date.UTC(1971, 3, 27), 1.18],
[Date.UTC(1971, 3, 30), 1.12],
[Date.UTC(1971, 4, 3), 1.06],
[Date.UTC(1971, 4, 6), 0.96],
[Date.UTC(1971, 4, 9), 0.87],
[Date.UTC(1971, 4, 12), 0.88],
[Date.UTC(1971, 4, 15), 0.79],
[Date.UTC(1971, 4, 18), 0.54],
[Date.UTC(1971, 4, 21), 0.34],
[Date.UTC(1971, 4, 25), 0]
]
}],
});
.highcharts-figure,
.highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
<script src="https://code.highcharts.com/highcharts.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
</figure>
To make the chart scrollable, you can use scrollablePlotArea feature.
chart: {
scrollablePlotArea: {
minWidth: 1600
}
}
Live demo: http://jsfiddle.net/BlackLabel/pm2ky5uw/
API Reference: https://api.highcharts.com/highcharts/chart.scrollablePlotArea
However, maybe some other series type will present data in a more visible way? Highcharts JS demos.
You can also consider using Highcharts Stock if columns are a must.
I am trying to draw some highcharts graph where the time intervals is being displayed as a thick line based on the date in one line so my series data are start and end times (Timestamp Objects from the database).
Highcharts.chart('container', {
chart: {
spacingTop: 0,
paddingTop: 0,
zoomType: 'x'
},
title: {
text: 'Workink time'
},
yAxis: {
title: {
text: 'Driving time'
}
},
xAxis: {
type: 'datetime',
},
series: [{
name: 'Date',
data: [
[Date.UTC(1970, 9, 21), 0],
[Date.UTC(1970, 10, 4), 0.28],
[Date.UTC(1970, 10, 9), 0.25],
[Date.UTC(1970, 10, 27), 0.2],
[Date.UTC(1970, 11, 2), 0.28],
[Date.UTC(1970, 11, 26), 0.28],
[Date.UTC(1970, 11, 29), 0.47],
[Date.UTC(1971, 0, 11), 0.79],
[Date.UTC(1971, 0, 26), 0.72],
[Date.UTC(1971, 1, 3), 1.02],
[Date.UTC(1971, 1, 11), 1.12],
[Date.UTC(1971, 1, 25), 1.2],
[Date.UTC(1971, 2, 11), 1.18],
[Date.UTC(1971, 3, 11), 1.19],
[Date.UTC(1971, 4, 1), 1.85],
[Date.UTC(1971, 4, 5), 2.22],
[Date.UTC(1971, 4, 19), 1.15],
[Date.UTC(1971, 5, 3), 0]
]
}]
});
It could be look like this picture.
You can add a serie for each of your start and end date tuple, link all of them the first series by setting an id for the first serie
id: 'Installation'
and using
linkedTo: 'Installation',
and set the same color
var color = '#7cb5ec';
this is how the series should look like
series: [{
id: 'Installation',
name: 'Installation',
color: color,
data: [[Date.UTC(1970, 9, 21), 1], [Date.UTC(1970, 9, 22), 1]]
}, {
name: 'Manufacturing',
linkedTo: 'Installation',
color: color,
data: [[Date.UTC(1970, 9, 23), 1], [Date.UTC(1970, 9, 24), 1]]
}, {
name: 'Sales & Distribution',
linkedTo: 'Installation',
color: color,
data: [[Date.UTC(1970, 9, 25), 1], [Date.UTC(1970, 9, 30), 1]]
}, {
name: 'Project Development',
linkedTo: 'Installation',
color: color,
data: [[Date.UTC(1970, 10, 5), 1], [Date.UTC(1970, 10, 10), 1]]
}, {
name: 'Other',
linkedTo: 'Installation',
color: color,
data: [[Date.UTC(1970, 10, 12), 1], [Date.UTC(1970, 10, 30), 1]]
}]
here if the full fiddle http://jsfiddle.net/32mhbyc5/
As I am unsure what the data in your example is meant to represent, I have used the data as #Liviu Boboia parsed it, to provide another example of how to create the broken line visual using the columnrange series type.
Code:
series: [{
data: [
[1, Date.UTC(1970, 9, 21), Date.UTC(1970, 9, 22)],
[1, Date.UTC(1970, 9, 23), Date.UTC(1970, 9, 24)],
[1, Date.UTC(1970, 9, 25), Date.UTC(1970, 9, 30)],
[1, Date.UTC(1970, 10, 5), Date.UTC(1970, 10, 10)],
[1, Date.UTC(1970, 10, 12), Date.UTC(1970, 10, 30)]
]
}]
Fiddle:
http://jsfiddle.net/jlbriggs/0jme6at3/
Output:
http://jsbin.com/enotab/39/editI want to show data from 2 different years on the same XAxis without using 2 x axes. In which case i get the following result
I want to have an overlay graph with the 2 series where 2012 series becomes a shadow graph. How is it possible? this is my static code:
var mychart = new Highcharts.Chart({
chart: {
renderTo: 'container',
zoomType: 'x'
},
title: {
text: 'Chart Title'
},
xAxis: [{
type: 'datetime',
minRange: 31 * 24 * 3600000,
labels: {
formatter: function () {
return Highcharts.dateFormat('%e %b %y', this.value);
}
}
}],
yAxis: {
title: {
text: 'Current Values'
},
gridLineColor: 'transparent',
plotLines: [{
value: 0,
color: 'green',
dashStyle: 'longdashdot',
width: 1
}, {
value: 30,
color: 'orange',
dashStyle: 'longdashdot',
width: 1
}, {
value: 60,
color: 'red',
dashStyle: 'longdashdot',
width: 1
}, {
value: 80,
color: 'black',
dashStyle: 'longdashdot',
width: 1
}]
},
tooltip: {
crosshairs: true,
shared: true
},
plotOptions: {
series: {
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, 'rgba(0,0,0,0.1)']
]
},
lineWidth: 1,
shadow: false,
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 5,
fillColor: 'red'
}
}
},
states: {
hover: {
lineWidth: 1
}
},
threshold: null
} //area
}, //plotoptions
series: [{
type: 'area',
//color:'#89a54e',
color: '#4572a7',
lineWidth: 0.1,
name: '2012',
// xAxis: 0,
zIndex: -1,
pointInterval: 24 * 3600 * 1000,
pointStart: Date.UTC(2013, 0, 1),
data: [
[Date.UTC(2013, 0, 1), 3],
[Date.UTC(2013, 0, 2), 12],
[Date.UTC(2013, 0, 3), 30],
[Date.UTC(2013, 0, 4), 22],
[Date.UTC(2013, 0, 5), 12],
[Date.UTC(2013, 0, 8), 13],
[Date.UTC(2013, 0, 9), 12],
[Date.UTC(2013, 0, 11), 13],
[Date.UTC(2013, 0, 12), 22],
[Date.UTC(2013, 0, 15), 1],
[Date.UTC(2013, 0, 16), 25],
[Date.UTC(2013, 0, 18), 43],
[Date.UTC(2013, 0, 19), 26],
[Date.UTC(2013, 0, 20), 23],
[Date.UTC(2013, 0, 21), 12],
[Date.UTC(2013, 0, 22), 13],
[Date.UTC(2013, 0, 23), 22],
[Date.UTC(2013, 0, 24), 1],
[Date.UTC(2013, 0, 25), 25],
[Date.UTC(2013, 0, 26), 43],
[Date.UTC(2013, 0, 27), 26],
[Date.UTC(2013, 0, 28), 23],
[Date.UTC(2013, 0, 29), 12],
[Date.UTC(2013, 0, 30), 13],
[Date.UTC(2013, 0, 31), 22],
[Date.UTC(2013, 1, 1), 1],
[Date.UTC(2013, 1, 2), -5],
[Date.UTC(2013, 1, 3), 43],
[Date.UTC(2013, 1, 4), 26],
[Date.UTC(2013, 1, 5), 23],
[Date.UTC(2013, 1, 6), 25],
[Date.UTC(2013, 1, 7), 43],
[Date.UTC(2013, 1, 8), 26],
[Date.UTC(2013, 1, 9), 23],
[Date.UTC(2013, 1, 10), 35],
[Date.UTC(2013, 1, 11), 38],
[Date.UTC(2013, 1, 14), 36],
[Date.UTC(2013, 1, 15), 3],
[Date.UTC(2013, 1, 16), 55],
[Date.UTC(2013, 1, 17), 43],
[Date.UTC(2013, 1, 18), 22],
[Date.UTC(2013, 1, 19), -3]
]
}, {
type: 'line',
name: '2013',
color: '#89a54e',
lineWidth: 3,
zIndex: 3,
// xAxis:1,
pointInterval: 24 * 3600 * 1000,
pointStart: Date.UTC(2012, 0, 1),
data: [
[Date.UTC(2012, 0, 1), 13],
[Date.UTC(2012, 0, 2), 52],
[Date.UTC(2012, 0, 3), 3],
[Date.UTC(2012, 0, 4), 12],
[Date.UTC(2012, 0, 5), 2],
[Date.UTC(2012, 0, 6), 35],
[Date.UTC(2012, 0, 7), 12],
[Date.UTC(2012, 0, 8), 35],
[Date.UTC(2012, 0, 9), 22],
[Date.UTC(2012, 0, 11), 3],
[Date.UTC(2012, 0, 12), 32],
[Date.UTC(2012, 0, 15), 41],
[Date.UTC(2012, 0, 16), 45],
[Date.UTC(2012, 0, 18), 63],
[Date.UTC(2012, 0, 19), 16],
[Date.UTC(2012, 0, 20), 83],
[Date.UTC(2012, 0, 21), 1],
[Date.UTC(2012, 0, 22), 75],
[Date.UTC(2012, 0, 23), 52],
[Date.UTC(2012, 0, 24), 1],
[Date.UTC(2012, 0, 25), 65],
[Date.UTC(2012, 0, 26), 13],
[Date.UTC(2012, 0, 27), 76],
[Date.UTC(2012, 0, 28), 56],
[Date.UTC(2012, 0, 29), 12],
[Date.UTC(2012, 0, 30), 13],
[Date.UTC(2012, 0, 31), 22],
[Date.UTC(2012, 1, 1), 1],
[Date.UTC(2012, 1, 2), 25],
[Date.UTC(2012, 1, 3), 43],
[Date.UTC(2012, 1, 4), 26],
[Date.UTC(2012, 1, 5), 23],
[Date.UTC(2012, 1, 6), 25],
[Date.UTC(2012, 1, 7), 43],
[Date.UTC(2012, 1, 8), 26],
[Date.UTC(2012, 1, 9), 23],
[Date.UTC(2012, 1, 10), 35],
[Date.UTC(2012, 1, 11), 48],
[Date.UTC(2012, 1, 14), 86],
[Date.UTC(2012, 1, 15), 73],
[Date.UTC(2012, 1, 16), 55],
[Date.UTC(2012, 1, 17), 43],
[Date.UTC(2012, 1, 18), 22],
[Date.UTC(2012, 1, 19), -3]
]
}]
});
});
It depends on what you want shown on the x axis. If you just want to keep the first axis labels, then simply remove the labels from the second x axis and offset it over the first:
xAxis:[ {type: 'datetime', minRange:31*24 *3600000 , offset:10,
labels: {formatter: function() {return Highcharts.dateFormat('%e %b', this.value);
}
} },
{type: 'datetime', minRange:31*24 *3600000 , offset:10,
labels: {enabled:false}
}],