I have two datasets (red, blue) that have data starting in 9/11 and one (green) with data starting in 2/13. The green one is starting in the same location as the others, but it should start in 2/13. How can I tell this dataset to do that? I'd rather not use 0's if there is a way around it.
You can put JavaScript's null value if you don't have any value. My English may not be that much good to explain but my example is clear. Also you can look at that page: http://www.highcharts.com/demo/area-missing/gray
<script>
$(function () {
$('.graph').highcharts({
chart: { type: 'line'},
plotOptions: { series: { connectNulls: true }},
xAxis: {categories: [2012,2011,2010,2009] },
yAxis: {title: { text: 'Example Fruit Consumption'}},
series: [
{ name:'Apple', data:[null,null,20000,41000]},
{ name:'Orange', data:[29458,29000,26892,23256]}
]
});
});
</script>
You can define pointStart() http://api.highcharts.com/highcharts#plotOptions.series.pointStart for serie.
Related
I have an idea how I can improve the user experience by altering some of my charts. Basically I have a column chart, where I display some values per category. The last value I display is the average.
I want to display the average value as a dotted line in each category.
Paint picture of idea displayed as a single category
I have read the documentation more times than I'm happy to admit, but I have still not found a proper solution. My best attempt was to overload the circle symbol in the 'scatter'-series and then redraw it as an SVG.
Does anyone have an idea to how I should approach it? I feel the option must be there, and I'm just missing the forest for the trees.
Best regards,
You can use line series type with calculated data:
const averageData = [3.33, 3.33, 3.66];
const processedAverageData = [];
averageData.forEach((val, index) => {
processedAverageData.push([index - 0.4, val], [index + 0.4, val]);
// To create gaps between categories
processedAverageData.push(null);
});
Highcharts.chart('container', {
chart: {
type: 'column'
},
xAxis: {
type: 'category'
},
series: [{
...
}, {
...
}, {
...
}, {
type: 'line',
data: processedAverageData,
dashStyle: 'dash',
marker: {
enabled: false
}
}]
});
Live demo: http://jsfiddle.net/BlackLabel/t3ejqvun/
API Reference: https://api.highcharts.com/highcharts/series.line
Here is a jsFiddle to my issue:
Highcharts.chart('container', {
xAxis: {
categories: [full arrray in fiddle],
labels: {
step: 1
}
},
series: [{
data: Array.from(Array(690).keys())
}]
});
https://jsfiddle.net/qws90dux/
The chart seems to only take the first and last label, why is this?
I think the reason this did not work is because of the amount of time needed to process each category which are long dates, this is basically what is written here
The solution was just to use xAxis.tickInterval instead, with the same interval as before.
Can someone help me to understand what is wrong here. Everything seems perfect.
http://jsfiddle.net/prakash4mail/nt86gj7z/1/
$(function () {
$('#container').highcharts({
chart: {
type: 'heatmap',
},
colorAxis: {
min: 0,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
series: [{
borderWidth: 1,
data: [[2020-04-01, 18000, 29060],[2020-04-01, 18500, 9920],[2020-04-01, 19000, 32160],[2020-04-02, 18000, 12400],[2020-04-02, 18500, 91880],[2020-04-02, 19000, 54000],[2020-04-03, 18000, 63540],[2020-04-03, 18500, 43420],[2020-04-03, 19000, 43420]],
dataLabels: {
enabled: true,
color: '#000000'
},
}]
});
});
heatMap showing lines instead of squares
The exact answer is rowsize: 500 (from UI perspective - height, YAxis difference between each point) and colsize: 86400000 (one day each, x-axis difference between each point). Missing this was causing box not to appear.
As I understood you would like to achieve something like is rendered here: http://jsfiddle.net/BlackLabel/o6ywag42/
Notice how the data structure looks like in this demo from Highcharts demo base:
https://jsfiddle.net/BlackLabel/uofntb4y/ - if you want to keep the points as a square the 'y' value must be growing one by one, like here: http://jsfiddle.net/BlackLabel/o7bgq1pu/
And to show your truly y scale you can use the categories feature.
yAxis: {
categories: ['18000', '18500', '19000']
},
API: https://api.highcharts.com/highcharts/yAxis.categories
EDIT:
Another solution suggested by #prakash is to use the series.rowsize property and series.colsize to fit the squares.
API: https://api.highcharts.com/highcharts/series.heatmap.rowsize
API: https://api.highcharts.com/highcharts/series.heatmap.colsize
I'm importing a csv file using Highcharts cvsURL for a line chart. I'm using styledMode and I defined the default colors. Highcharts is using my stylesheet. Is there an easy way to tell each series which color to use?
I have lots of lines, so highcharts cycles through its 10 default colors. I need one of the colors to only be assigned to 2 specific series though.
Here is my code so far:
Highcharts.chart('container', {
chart: {
type: 'line',
styledMode: true //this totally separates the design from the svg.
},
data: {
itemDelimiter: ',',
csvURL: 'http://deq.at.utah.gov/wp-content/themes/deq/parts/charts/Ozone-4th-Highest-8hr-Front.csv'
},
title: {
text: 'Ozone 4th Highest 8-hr Concentration Wasatch Front'
},
yAxis: {
title: {
text: '(Ozone PPM)'
}
}
});
I think the API said something about assigning classes to a series. Maybe that would work because I could make custom CSS for only those series, but I can't see how to do that using csvURL.
You can define color or className for series in this way:
data: {
csvURL: '...'
},
series: [{
color: '#00c735'
}, {
color: '#c4392d'
}]
Live demo: https://jsfiddle.net/BlackLabel/kj9udgat/1/
API Reference:
https://api.highcharts.com/highcharts/series.line.className
https://api.highcharts.com/highcharts/series.line.color
I want to draw a line on a ohlc chart, but i dont want the new series to introduce gaps.
The first series (ohlc) should still place the candles in an nica way with constant gaps between them regardles of open-close times (i think its only the "ordinal" value that does this, but unfortunatelly you cant specify it at series level, but only axis level).
xAxis: {
ordinal: true
},
example:
http://jsfiddle.net/5r97owky/8/
Thank you for any help
The gaps are caused by ordinal option. You can create additional xAxis for line series:
Highcharts.stockChart('container', {
chart: {
events: {
load: function() {
var xAxes = this.xAxis,
extremes = xAxes[0].getExtremes();
xAxes[1].setExtremes(extremes.min, extremes.max, true, false);
}
}
},
xAxis: [{}, {
visible: false
}],
...
});
Live demo: http://jsfiddle.net/BlackLabel/1mbo2zp4/
API: https://api.highcharts.com/highstock/xAxis.ordinal