highcharts heatmap drilldown link on yasix - highcharts

I created highcharts heatmap with drilldown. Drilldown has link on xaxis lable. Could I have link only on yaxis? And remove link on xaxis. Since my drilldown chart is associate to y not x.
Highcharts.chart('container', {
chart: {
type: 'heatmap'
},
colorAxis: {
min: 0,
stops: [
[0, '#7EAB55'],
[0.5, '#FFFE55'],
[1, '#B02418']
],
},
series: [{
data: [{
x: 0,
y: 0,
value: 0,
drilldown: 'animals'
}, {
x: 0,
y: 1,
value: 1
}, {
x: 1,
y: 0,
value: 2,
drilldown: 'animals'
}, {
x: 1,
y: 1,
value: 1
}],
dataLabels: {
enabled: true,
color: '#000000'
}
}],
drilldown: {
series: [{
id: 'animals',
data: [
[0, 3, 1],
[1, 1, 4],
[2, 4, 3]
]
}]
}
});
This is example in fiddle. Thanks.
https://jsfiddle.net/lundi/jdc4mpk2/

From Sebastian's suggestion, this is the answer.
You can use the chart.inverted feature to achieve the wanted result: jsfiddle.net/BlackLabel/82qapmoe

Related

Highchart drill down only display one data serie

I'm trying to implement a drill down on a bar chart.
My data series are splitted on 6 categories on the x axis and I have three different series (Social, Cognitive and Language).
I would like to be able to drill down in my series. For example, 'social' is made of 'Family' and 'Personnal'.
My problem is that highchart only wants to drill down into one data serie. In my case I would like the drill down to display serveral data series.
In the fiddle below, I would like the drill down from 'Social' to display the series 'Family' and 'Personnal'. But highchart only display the 'Personnal' serie.
Is there a standard way to do this with Highcharts?
series: [
{
name: 'Social',
type: 'bar',
data: [
{ y: 10, drilldown: 'A' },
{ y: 5, drilldown: 'A' },
{ y: 3, drilldown: 'A' },
{ y: 1, drilldown: 'A' },
{ y: 0, drilldown: 'A' },
{ y: 0, drilldown: 'A' },
],
color: '#EEAA3C',
},
{
name: 'Cognitive',
type: 'bar',
data: [6, 3, 1, 0, 1, 1],
color: '#86BD4A',
},
{
name: 'Language',
type: 'bar',
data: [4, 2, 0, 2, 0, 0],
color: '#E26E3E',
},
],
drilldown: {
series: [
{
name: 'Family',
id: 'A',
type: 'bar',
data: [1, 1, 1, 0, 0, 0],
color: '#F2B553',
},
{
name: 'Personal',
id: 'A',
type: 'bar',
data: [9, 4, 2, 1, 0, 0],
color: '#F8CC87',
},
],
},
https://jsfiddle.net/pacambi/3k4eng7w/
Thanks !

Milestone Trendanalysis with Highcharts

Is it possible to make the following chart with Highcharts library?
It's a simple line chart but with inverted triangle shaped grid. Is there any predefined type or a way to customize the grid shape? Any pointers which will guide me to a proper direction would help. Thank you!
Another method of how to create this type of chart:
Demo
Highcharts.chart('container', {
chart: {
width: 500,
},
xAxis: {
opposite: true,
title: {
text: 'Report Date'
},
gridLineWidth: 1,
type: 'datetime',
categories: ['01/01/2012', '02/01/2012', '03/01/2012', '04/01/2012', '05/01/2012', '06/01/2012', '07/01/2012', '08/01/2012', '09/01/2012', '10/01/2012'],
tickmarkPlacement: 'on',
labels: {
rotation: -90,
y: -18
},
offset: -13,
lineWidth: 0,
max: 8.6,
},
legend: {
enabled: false
},
yAxis: {
title: {
text: 'Milestones'
},
categories: ['01/01/2012', '02/01/2012', '03/01/2012', '04/01/2012', '05/01/2012', '06/01/2012', '07/01/2012', '08/01/2012', '09/01/2012', '10/01/2012'],
tickmarkPlacement: 'on',
gridLineWidth: 1,
tickPosition: 'inside',
min: 0,
minPadding: 0,
startOnTick: false
},
series: [{
data: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
marker: {
enabled: false
},
color: 'grey',
enableMouseTracking: false,
animation: false
}, {
data: [6, 6, 6, 7, 8, 7, 7, 8, 8.5, 9]
}, {
data: [5, 5, 5, 6, 6.5, 6, 6.5, 7.5, 8]
}, {
data: [4, 4, 4, 5, 5.5, 5.5, 6]
}, {
data: [2, 2.5, 2.5, 3.5, 4]
}, {
data: [1, 1.5, 2]
}, {
type: 'arearange',
data: [[0, 0, -5], [9.2, 9, -5]],
color: 'white',
fillOpacity: 1,
marker: {
enabled: false
},
zIndex: -1,
enableMouseTracking: false,
animation: false
}]
});
There is no such series type. However, you can make it with fake polygon series that will hide half of the chart. Check demo and code posted below.
Code:
Highcharts.chart('container', {
chart: {
height: 500,
width: 500,
events: {
load: function() {
var chart = this,
polygon = chart.series[2].group,
x = polygon.translateX,
y = polygon.translateY;
polygon.translate(x + 3, y + 3);
}
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
xAxis: {
opposite: true,
gridLineWidth: 1,
gridLineColor: '#ddd',
tickInterval: 1,
maxPadding: 0,
lineWidth: 0,
max: 10,
min: 0
},
yAxis: {
maxPadding: 0,
tickInterval: 1,
gridLineColor: '#ddd',
max: 10,
min: 0
},
series: [{
name: 'Installation',
data: [8, 6, 7, 8, 7, 6]
}, {
name: 'Manufacturing',
data: [3, 2, 4, 4]
}, {
type: 'polygon',
animation: false,
showInLegend: false,
enableMouseTracking: false,
color: '#fff',
lineWidth: 10,
data: [
[0, 0],
[10, 0],
[10, 10]
]
}, {
type: 'line',
showInLegend: false,
enableMouseTracking: false,
data: [
[0, 0],
[10, 10]
],
color: '#ddd',
lineWidth: 1,
marker: {
enabled: false
}
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<div id="container"></div>
Demo:
https://jsfiddle.net/BlackLabel/xL9taoym/1/
You can use Highcharts SVG Renderer to render triangle that covers half of the chart.
Check this demo: https://jsfiddle.net/BlackLabel/2boma9zs
events: {
load: function() {
var chart = this,
left = chart.plotLeft,
top = chart.plotTop,
width = chart.plotSizeX,
height = chart.plotSizeY;
chart.renderer.path([
'M', left + 1, top + height,
'L', left + width + 1, top,
left + width + 3, top,
left + width + 3, top + height + 3,
left + 1, top + height + 3,
left + 1, top + height
])
.attr({
fill: '#fff'
})
.add()
.toFront();
}
}
API Reference: https://api.highcharts.com/class-reference/Highcharts.SVGRenderer#path
https://api.highcharts.com/class-reference/Highcharts.SVGElement#toFront
https://api.highcharts.com/highcharts/chart.events.load

Highcharts bubble horizontal stacking

I need to set horizontal bubble stacking, i got four stacked columns and i need to place bubbles on top of each. I made vertical stacking, but horizontaly they stay on on each
My code: http://jsfiddle.net/Hideon/7bu2z0mk/1/
Highcharts.chart('container', {
chart: {
type: 'column'
},
xAxis: {
type: 'datetime',
},
plotOptions: {
pointWidth: 1,
column: {
stacking: 'normal',
pointRange: 1000 * 60 * 60 * 24
},
bubble: {
stacking: 'normal',
}
},
series: [
{
type: 'bubble',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9,
z: 5
},
],
stack: 0
},
{
type: 'bubble',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9,
z: 5
},
],
stack: 0
},
{
type: 'bubble',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9,
z: 5
},
],
stack: 1
},
{
type: 'bubble',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9,
z: 5
},
],
stack: 1
},
{
type: 'column',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9
},
],
stack: 0
}, {
type: 'column',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9
},
],
stack: 0
}, {
type: 'column',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9
},
],
stack: 1
}, {
type: 'column',
data: [{
x: Date.UTC(2010, 0, 1),
y: 29.9
},
],
stack: 1
}
]
});
Stacking for bubble series type is not supported, but you can implement it. Please take a look at the example below, you can calculate y value for all bubble points by using toValue method:
Highcharts.chart('container', {
chart: {
events: {
load: function() {
var bubble = this.series[0],
yAxis = this.yAxis[0],
base = yAxis.toPixels(0),
xVal = 0,
radius,
newY = 0;
Highcharts.each(bubble.points, function(p, i) {
if (p.x !== xVal) {
xVal = p.x;
newY = 0;
}
radius = p.marker.radius;
newY += yAxis.toValue(base - radius)
p.update({
y: newY
});
newY += yAxis.toValue(base - radius);
});
}
}
},
yAxis: {
min: 0,
max: 5
},
series: [{
type: 'bubble',
data: [
[0, 0, 10],
[0, 0, 20],
[0, 0, 15],
[0, 0, 12],
[0, 0, 20],
[0, 0, 15],
[1, 0, 11],
[1, 0, 12],
[1, 0, 13],
[1, 0, 14],
[1, 0, 16],
[1, 0, 15]
]
}]
});
Live demo: http://jsfiddle.net/BlackLabel/dmn63hce/
API: https://api.highcharts.com/class-reference/Highcharts.Axis#toValue

HighCharts Polar Labels in between of sectors of circle

I am working ReactHigh charts on polar graphs, I want my labels to come in between the sectors of the circle, they are coming on points but i dont want them to come there.
JSfiddle : https://jsfiddle.net/ra73mp0c/12/
Also I want a background color on each of the labels.
Graph as of now :
Desried Outcome :
Please help me .
Config of graph :
const config = {
chart: {
polar: true,
type: 'line',
width: 700,
backgroundColor: 'transparent',
plotBorderWidth: null,
margin: [0, 0, 0, 0],
spacingTop: 0,
spacingBottom: 0,
spacingLeft: 0,
spacingRight: 0
},
title: {
text: null
},
pane: {
size: '80%'
},
xAxis: {
categories: [
'Sales',
'Sales',
'Sales',
'Sales',
'Marketing',
'Development',
'Customer Support',
'Customer Support',
'Customer Support',
'Information Technology'
],
labels: {
style: {
fontSize: '13px',
fontFamily: 'Verdana, sans-serif'
}
},
tickmarkPlacement: 'on'
},
yAxis: {
gridLineInterpolation: 'polygon',
min: 0,
tickInterval: 1,
max: 6
},
tooltip: {
shared: true
},
legend: {
enabled: false
},
credits: { enabled: false },
series: [
{
name: 'Allocated Budget',
data: [1, 2, 3, 1, 4, 3, 1, 2, 4, 1],
pointPlacement: 'between'
},
{
name: 'Actual Spending',
data: [2, 4, 2, 1, 3, 4, 2, 2, 1, 4],
pointPlacement: 'between'
}
]
}
Thanks a lot, It would be helpful ig you can edit the fiddle Link https://jsfiddle.net/ra73mp0c/12/
Creating that kind of background for x axis labels is not supported in Highcharts.
As a workaround you can create a phantom series that mimics their look:
{
showInLegend: false,
type: 'polygon',
name: 'Labels background',
data: [
[1, 5],
[2, 5],
[2, 6],
[1, 6]
],
zIndex: -9999
}
labels.distance should be a negative value to make it work.
Demo: https://jsfiddle.net/BlackLabel/63nc1csv/

Basic Highcharts Bubble Drilldown

I'm new at Highcharts. I'm trying to create a Drilldown Bubble Chart.
I took the basic column drilldown as a starting point,
http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/drilldown/basic/
chart: {
type: 'column'
},
title: {
text: 'Basic drilldown'
},
xAxis: {
type: 'category'
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: [{
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals',
y: 5,
drilldown: 'animals'
}, {
name: 'Fruits',
y: 2,
drilldown: 'fruits'
}, {
name: 'Cars',
y: 4,
drilldown: 'cars'
}]
}],
drilldown: {
series: [{
id: 'animals',
data: [
['Cats', 4],
['Dogs', 2],
['Cows', 1],
['Sheep', 2],
['Pigs', 1]
]
}, {
id: 'fruits',
data: [
['Apples', 4],
['Oranges', 2]
]
}, {
id: 'cars',
data: [
['Toyota', 4],
['Opel', 2],
['Volkswagen', 2]
]
}]
}
and edited it a bit, to get this,
http://jsfiddle.net/Slate_Shannon/kdwa9x7v/1/
$(function() {
$('#container').highcharts({
chart: {
type: 'bubble'
},
title: {
text: 'Basic drilldown'
},
xAxis: {
type: 'linear'
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: [{
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals',
x: 4,
y: 5,
z: 10,
drilldown: 'animals'
}, {
name: 'Fruits',
x: 14,
y: 20,
z: 20,
drilldown: 'fruits'
}, {
name: 'Cars',
x: 8,
y: 9,
z: 7,
drilldown: 'cars'
}]
}],
drilldown: {
series: [{
id: 'animals',
data: [
['Cats', x: 5, y: 9, z: 7],
['Dogs', x: 8, y: 8, z: 9],
['Cows', x: 1, y: 5, z: 2],
['Sheep', x: 4, y: 7, z: 2],
['Pigs', x: 4, y: 5, z: 7]
]
}, {
id: 'fruits',
data: [
['Apples', x: 2, y: 9, z: 6],
['Oranges', x: 6, y: 5, z: 1]
]
}, {
id: 'cars',
data: [
['Toyota', x: 2, y: 8, z: 7],
['Opel', x: 8, y: 2, z: 4],
['Volkswagen', x: 4, y: 4, z: 4]
]
}]
}
});
});
All I did was
change the chart type to "bubble",
add the x and z data,
change the xaxis to "linear"
And it doesn't work.
Can you see the problem?
Thanks much!
Good day.
The formatting of your drilldown data is incorrect, as hinted to in console. Currently you have:
data: [
['Cats', x: 5, y: 9, z:7],
['Dogs', x: 8, y: 8, z:9],
// ...
]
This is half way between an array declaration and a object declaration. I'd suggest switching to each item being an object, like this:
data: [
{ name: 'Cats', x: 5, y: 9, z:7 },
{ name: 'Dogs', x: 8, y: 8, z:9 },
// ...
]
Secondly, you haven't included the required Highcharts-more module which includes the bubble chart type. You can do that like this:
<script src="https://code.highcharts.com/highcharts-more.js"></script>
See this updated JSFiddle for a basic example of how it can work.

Resources