Highcharts Bar Chart Without Column - javascript

i'm new to highcharts.
I already browse in highcharts example. but, every time I look for the sample, it came with the column bar chart like this :
All I want is like this :
But I dont know how. Maybe you can help me figured it out.
Thank you.

You can simply set x/y pairs for each of points. Then set column.grouping to false: http://jsfiddle.net/27u9zuhj/
plotOptions: {
column: {
grouping: false
}
},
series: [{
name: 'John',
data: [ [0, 5], [1, 3], [2, 4]]
}, {
name: 'Jane',
data: [ [3, 2], [4, 2]]
}]

Related

Graph getting hidden while zooming in ( using the zoom scroll bar )

I am using HighChart's stock chart. The chart is rendering correctly. But, while zooming in my graph line alone is getting hidden. But, when I am moving back to the last position the graph is displaying correctly.
Please guide me to resolve this.
Thanks in advance!
You are providing the data array that is not sorted as you can see in the Highcharts error - https://www.highcharts.com/errors/15. So, the solution is to sort data. Check the demo posted below.
Code:
Highcharts.StockChart({
chart: {
renderTo: 'container1',
zoomType: 'x'
},
xAxis: {
type: 'datetime',
},
series: [{
name: 'AAPL',
data: [
[1556881096000, 3],
[1556881096000, 3],
[1556881096000, 3],
[1556881096000, 3],
[1556880496000, 3],
[1556880496000, 3],
[1556880496000, 3],
[1556880496000, 3],
[1556879896000, 9],
[1556879896000, 9]
].sort()
}]
});
Demo:
http://jsfiddle.net/BlackLabel/n2bLro7g/3/

Baidu's echarts - filling up space between 2 lines

I would like to find an approach on how to draw 2 lines in ECharts and fill up the space between them like this:
So that each line has it's own color. Depending on order of lines - area is filled into one color or another (see image).
Is there a native way of doing it? I found that some people are mentioning extensions, but nobody is providing any kind of instructions on how to write them from scratch.. Nor I found any examples on official documentation page. I would appreciate if somebody could point me to correct direction on how to achieve this goal.
In the worst case - I would accept other libraries if they have such very needed option.
The best I could do is this:
var chartOptions = {
xAxis: [{
type: 'value'
}],
yAxis: [{
type: 'value'
}],
series: [{
type: "line",
data: [[0, 4], [1, 3], [2, 2], [3, 2], [4, 1], [5, 2]],
}, {
type: "line",
data: [[0, 2], [1, 3], [2, 4], [3, 8], [4, 5], [5, 0]],
}],
};
var aChart = echarts.init(document.getElementById('aGraph'));
aChart.setOption(chartOptions);
I've used areaStyle to fill the area between the axisLine and the data. I would try to solve this issue by adding the green/yellow areaStyle to the green series, adding a pink areaStyle to the red series, and then adding a white areaStyle to a new series made up from the min values from the other two series. Combined with a lineStyle with a width of 0, you could mostly achieve the look in the sketch, however, the minimum series fill would probably also obscure the interior grid lines.

Multiple X-axis values in highcharts

I have a line graph which can drop down in a straight line. e.g. I have a point at (1, 100) then a point at (1,0). However, highcharts (https://www.highcharts.com/) will only display information for one of the points. Is it possible to get it to show information on both points when I hover over each of them?
The default for line type series is findNearestPoint: 'x' https://api.highcharts.com/highcharts/plotOptions.line.findNearestPointBy .
If you change that to findNearestPoint: 'xy', you'll get the behavior you want.
Highcharts.chart('container', {
series: [{
findNearestPointBy:'xy',
data: [
[0, 29.9],
[1, 50],
[1, 71.5],
[3, 106.4]
]
}]
});
http://jsfiddle.net/vt1cep0L/2/

Possible to change the height inside the highchart drilldown?

I tried to create the dynamic height in high chart's drill down. Depends on data. Then chart type is bar chart.
For example
drilldown: {
series: [{
id: 'animals',
data: [
['Cats', 4],
['Dogs', 2],
['Cows', 1],
['Sheep', 2],
['Pigs', 1]
], $("#container").css({'height':'500px'}) // here i want to change
}, {
id: 'fruits',
data: [
['Apples', 4],
['Oranges', 2]
], $("#container").css({'height':'300px'}) // here i want to change
}, {
id: 'cars',
data: [
['Toyota', 4],
['Opel', 2],
['Volkswagen', 2]
], $("#container").css({'height':'400px'}) // here i want to change
}]
}
It is possible to add the jQuery into series section. I mentioned above. Or else any possible way for to do it?
You can catch drilldown event and then call setSize function.
chart: {
type: 'bar',
events: {drilldown:function(a){ this.setSize(300, a.seriesOptions.data.length*100) }}
}
drilldown function is trigger as an when user is click on individual bar and argument "a" is holding the series data of that particular bar which user has click, and I've calculate the length of that data with "a.seriesOptions.data.length*100" and 100 is 100px, so if length is 2 then 2*100px = 200px.

Highcharts skip non-provided steps in a series

I have bar chart in high chart. I send it items for x & y. It happened that x-values are numerics. In such case, it assumes that there are missing entries and add the missing entries. I want to force high chart not to include those assumed items. Is that possible without using categories?
http://jsfiddle.net/96bk4661/1/
$(function () {
$('#container').highcharts({
"chart": {
"type": "column"
},
"series": [{
"name": "X-Axis",
"data": [
[1, 77926],
[2, 71245],
[4, 75275],
[5, 78175],
[6, 75369],
[7, 78145],
[8, 77638],
[9, 75706],
[12, 77491]
],
"color": "#1AA4D5"
}]
});
});
This one is different from http://stackoverflow.com/questions/15973457/automatically-join-missing-data-gaps-in-highcharts-js
I don't want the values to be included on the x-axis.
Use highstock and then set ordinal parameter as true.
xAxis:{
ordinal:true
},
Example: http://jsfiddle.net/96bk4661/2/
Seems there's no other way and I am using categories. Thanks #Ondkloss !

Categories

Resources