Vis.js Per Group Physics - vis.js
I'll start by describing what I'd like to achieve. The attached image is the closest I've gotten.
The 3 blue Hexes should all be in contact.
The pink Hexes should all run horizontally.
The white (and one red) should flow roughly as they do from the green to the pink where they attach. all these links should be uniform in length.
The yellow should do the same starting from the orange.
I am able to achieve #1 as long as there are no other hexes attached. I think I could get what I'm looking for if I could have the 4 groups not affected by each other's physics as much as they are. The connections between the white and pink and yellow and pink can be longer than the ones between the white and orange as needed to make it 'fit'.
There are 4 physics: false nodes attached to the green, left pink, orange, and all three blues. the fixed attribute seemed more appropriate but when positioned that way the nodes seemed to ignore the x and y values. These are used to pull the graphic into shape. I'm open to alternative ways of doing that too.
Is there another way to achieve what I'm looking for? At the very least is there a way to force the pink nodes to prefer running horizontally?
I've tried various physics solvers. The default barnesHut is what I'm using currently.
var hex_style = 'cursor: pointer; stroke: #000; stroke-width: 1;';
var hextext_style = 'text-align: center; height: 56%; width: 80%; padding: 22% 10%;';
var present_style = 'fill: #55F; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var past_style = 'fill: #F99; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var nirvana_style = 'fill: #5F5; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var future_nirvana_style = 'fill: #FFF; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var hell_style = 'fill: #FA0; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var future_hell_style = 'fill: #EE9; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var wild_card_style = 'fill: #F66; font-size: 35px; cursor: pointer; fill-opacity: 1; stroke: #000; stroke-width: 1; transform: rotate(90deg); transform-origin: 50% 50%;';
var description_white_style = 'color:white; font-size: 35px';
var description_black_style = 'color:black; font-size: 35px';
var hexsvg = function(svg_class, poly_class, div_class, message_class, message) {
var svg = '<svg style="' + svg_class + '" xmlns="http://www.w3.org/2000/svg" version="1.1" width="300" height="300" xmlns:xlink="http://www.w3.org/1999/xlink">' +
'<polygon style="' + poly_class + '" points="300,150 225,280 75,280 0,150 75,20 225,20"></polygon>' +
'<foreignObject x="0" y="0" width="100%" height="100%">' +
'<div style="' + div_class + '" xmlns="http://www.w3.org/1999/xhtml">' +
'<span style="' + message_class + '">' + message + '</span>' +
'</div>' +
'</foreignObject>' +
'</svg>';
return svg;
};
var svgurl = function(svg) {
return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg);
};
var network;
var draw = function() {
if (network) {
network.destroy();
}
var nodes = [];
var edges = [];
// Add the nodes
nodes.push({
id: 'present_1',
group: 'present',
shape: 'image',
image: svgurl(hexsvg(hex_style, present_style, hextext_style, description_white_style, ''))
});
nodes.push({
id: 'present_2',
group: 'present',
shape: 'image',
image: svgurl(hexsvg(hex_style, present_style, hextext_style, description_white_style, ''))
});
nodes.push({
id: 'present_3',
group: 'present',
shape: 'image',
image: svgurl(hexsvg(hex_style, present_style, hextext_style, description_white_style, ''))
});
nodes.push({
id: 4,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 5,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 6,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 7,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 8,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 9,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 10,
group: 'past',
shape: 'image',
image: svgurl(hexsvg(hex_style, past_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 'nirvana_1',
group: 'nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, nirvana_style, hextext_style, description_white_style, ''))
});
nodes.push({
id: 11,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 12,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 13,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 14,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 15,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 'wild_card',
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, wild_card_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 16,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 17,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 18,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 19,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 20,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 21,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 22,
group: 'future_nirvana',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_nirvana_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: "hell_1",
group: 'hell',
shape: 'image',
image: svgurl(hexsvg(hex_style, hell_style, hextext_style, description_white_style, ''))
});
nodes.push({
id: 24,
group: 'future_hell',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_hell_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 25,
group: 'future_hell',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_hell_style, hextext_style, description_black_style, ''))
});
nodes.push({
id: 26,
group: 'future_hell',
shape: 'image',
image: svgurl(hexsvg(hex_style, future_hell_style, hextext_style, description_black_style, ''))
});
// Central present node
nodes.push({
id: 'present_fixed',
x: 2500,
y: 500,
physics: false,
color: 'rgba(0,255,0,0)',
level: 2
});
edges.push({
from: 'present_1',
to: 'present_fixed',
smooth: {
type: 'discrete',
roundness: 0
},
color: {
color: 'white',
opacity: 0
}
});
edges.push({
from: 'present_2',
to: 'present_fixed',
smooth: {
type: 'discrete',
roundness: 0
},
color: {
color: 'white',
opacity: 0
}
});
edges.push({
from: 'present_3',
to: 'present_fixed',
smooth: {
type: 'discrete',
roundness: 0
},
color: {
color: 'white',
opacity: 0
}
});
// Present
edges.push({
from: 'present_1',
to: 'present_2',
smooth: {
type: 'discrete',
roundness: 0
}
});
edges.push({
from: 'present_2',
to: 'present_3',
smooth: {
type: 'discrete',
roundness: 0
}
});
edges.push({
from: 'present_3',
to: 'present_1',
smooth: {
type: 'discrete',
roundness: 0
}
});
// Past edges: {
edges.push({
from: 4,
to: 'present_1'
});
edges.push({
from: 5,
to: 4
});
edges.push({
from: 6,
to: 5
});
edges.push({
from: 7,
to: 6
});
edges.push({
from: 8,
to: 7
});
edges.push({
from: 9,
to: 8
});
edges.push({
from: 10,
to: 9
});
// Fixed Past node
nodes.push({
id: 'past_fixed',
x: 0,
y: 500,
physics: false,
color: 'rgba(0,0,0,0)',
level: 2
});
edges.push({
from: 'past_fixed',
to: 10,
smooth: {
type: 'discrete',
roundness: 0
},
color: {
color: 'white',
opacity: 0
}
});
// Central Hell node
nodes.push({
id: 'hell_fixed',
x: 3250,
y: 1000,
physics: false,
color: 'rgba(0,0,0,0)',
level: 3
});
edges.push({
from: 'hell_1',
to: 'hell_fixed',
smooth: {
type: 'discrete',
roundness: 0
},
color: {
color: 'white',
opacity: 0
}
});
// Hell Path
edges.push({
from: 24,
to: 'hell_1'
});
edges.push({
from: 25,
to: 24
});
edges.push({
from: 26,
to: 25
});
edges.push({
from: 4,
to: 26,
length: 400,
smooth: {
type: 'vertical'
}
});
// Central Nirvana node
nodes.push({
id: 'nirvana_fixed',
x: 4000,
y: 0,
physics: false,
color: 'rgba(0,0,0,0)',
level: 1
});
edges.push({
from: 'nirvana_1',
to: 'nirvana_fixed',
smooth: {
type: 'discrete',
roundness: 0
},
color: {
color: 'white',
opacity: 0
}
});
// Nirvana Path
edges.push({
from: 11,
to: 'nirvana_1'
});
edges.push({
from: 12,
to: 11
});
edges.push({
from: 13,
to: 12
});
edges.push({
from: 14,
to: 13
});
edges.push({
from: 15,
to: 14
});
edges.push({
from: 'wild_card',
to: 15
});
edges.push({
from: 16,
to: 'wild_card'
});
edges.push({
from: 17,
to: 16
});
edges.push({
from: 18,
to: 17
});
edges.push({
from: 19,
to: 18
});
edges.push({
from: 20,
to: 19
});
edges.push({
from: 21,
to: 20
});
edges.push({
from: 22,
to: 21
});
edges.push({
from: 10,
to: 22,
length: 500,
smooth: {
type: 'vertical'
}
});
// DOM element where the Network will be attached
var container = document.getElementById('hexchart');
var data = {
nodes: nodes,
edges: edges
};
// Configuration for the Network
var options = {
nodes: {
size: 125
},
edges: {
smooth: {
type: 'horizontal'
}
},
groups: {
present: {
background: 'blue',
mass: 50
},
past: {
background: 'pink'
},
nirvana: {
background: 'green'
},
hell: {
background: 'orange'
},
future_nirvana: {
background: 'white'
},
future_hell: {
background: 'yellow'
}
},
physics: {
solver: 'barnesHut',
/*forceAtlas2Based: {
gravitationalConstant: -600,
centralGravity: 0.0,
springConstant: 0.2,
springLength: 0,
damping: 0.06,
avoidOverlap: 1
},*/
barnesHut: {
gravitationalConstant: -7000,
centralGravity: 0.1,
springLength: 155,
springConstant: 1.0,
damping: 0.8,
avoidOverlap: 0.75
}
}
/*,
configure: {
filter: 'physics',
container: document.getElementById('optionsContainer'),
showButton: false
}*/
};
// Create a Network
network = new vis.Network(container, data, options);
};
document.onload(draw());
#hexchart {
width: 100%;
height: 800px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.js"></script>
<div id="optionsContainer" style="float:right"></div>
<div id="hexchart"></div>
vis.js 4.21.0
rendering in chrome
Related
How to connect Firebase on a graph?
I'm new in TypeScript, I would like to know how to connect information saved in Firebase to a graph? I use Ionic v3 and I'm using the Highcharts library to generate the graph. I've read the documentation AngularFire2, but still can not find a solution. I would like to see an example, please. Code: I have a CRUD that creates a list of name "Item": item.models.ts: export interface Item { key?: string; data: string; humor: string; mania: string; numero: string; medicamento?: string; dormidas?: string; menstrual?: boolean; evento?: string; impacto?: number; outras?: string; } See how the data is stored in firebase: I can create a static graph only, I would like the graphic to be dynamic and with the data stored in Firebase. On the X axis I want to put the variable "data" and on the Y axis the variable "numero". .html <div [chart]="chart"></div> .TS chart = new Chart ({ chart: { type: 'spline' }, title: { text: undefined }, xAxis: { type: 'datetime', labels: { overflow: 'justify' } }, yAxis: { title: { text: undefined }, minorGridLineWidth: null, gridLineWidth: null, alternateGridColor: null, plotBands: [{ from: 0.5, to: 1.5, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Grave Depressão', style: { color: '#606060' } } }, { from: 1.5, to: 2.5, color: 'rgba(0, 0, 0, 0)', label: { text: 'Moderado Alto Depressão', style: { color: '#606060' } } }, { from: 2.5, to: 3.5, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Moderado Baixo Depressão', style: { color: '#606060' } } }, { from: 3.5, to: 4.5, color: 'rgba(0, 0, 0, 0)', label: { text: 'Leve Depressão', style: { color: '#606060' } } }, { from: 4.5, to: 5.5, color: 'rgba(244, 246, 245, 1)', label: { text: 'Estável', style: { color: '' } } }, { from: 5.5, to: 6.5, color: 'rgba(0, 0, 0, 0)', label: { text: 'Leve Mania', style: { color: '#606060' } } }, { from: 6.5, to: 7.5, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Moderado Baixo Mania', style: { color: '#606060' } } }, { from: 7.5, to: 8.5, color: 'rgba(0, 0, 0, 0)', label: { text: 'Moderado Alto Mania', style: { color: '#606060' } } },{ from: 8.5, to: 9.5, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Grave Mania', style: { color: '#606060' } }, }] }, series: [{ name: 'Humor', data: [3, 6, 8, 4, 2, 1, 5, 3, 8, 5, 4, 9, 4, 1, 5, 7] }], }) Result: Could someone please help me connect Firebase to my graph?
Setting individual color for each part of Box Plot in Highchart
I would like to have top of the box and bottom of the box in different colors, and also top of the whisker and bottoom of the whisker in different color for each box (region). But all of the lines in the box are in the same color (red) and top and bottom of the whisker are in the same color (green) Live demo with steps to reproduce Highcharts.chart('container', { chart: { type: 'boxplot' }, title: { text: 'All Patients' }, legend: { enabled: true }, xAxis: { categories: ['Asia Pacific', 'Europe', 'Latin America', 'North America', 'SWAC'], title: { text: ' ' } }, yAxis: { title: { text: 'Annual Center Volume 2016' }, tickInterval: 5, min: 0, max: 75 //plotLines: [{ // value: 932, // color: 'red', // width: 1, // label: { // text: 'Theoretical mean: 932', // align: 'center', // style: { // color: 'gray' // } // } //}] }, plotOptions: { boxplot: { fillColor: '#F0F0E0', lineWidth: 2, upperQuartileColor: 'green', lowerQuartileColor: 'green', medianColor: '#0C5DA5', medianWidth: 3, stemColor: '#A63400', stemDashStyle: 'solid', stemWidth: 1, whiskerColor: '#3D9200', whiskerLength: '20%', whiskerWidth: 3 } }, series: [{ name: 'Region Runs', showInLegend: false, color: 'red', data: [ [2, 4, 18, 43, 53], [5, 9, 16.5, 32, 52], [1, 3, 6, 11.5, 21], [3, 9, 20, 38, 73], [1, 2, 8, 16, 20] ], tooltip: { headerFormat: '<em>Experiment No {point.key}</em><br/>' } }, { name: '75th Percentile', type: 'line', color: 'red', marker: { symbol: 'square' }, }, { name: 'Median', type: 'line', color:'#0C5DA5', marker: { symbol: 'square' }, }, { name: '25th Percentile', type: 'line', color: 'red', marker: { symbol: 'square' }, }, { name: '90th percentile', type: 'line', color: '#3D9200', marker: { symbol: 'square' }, },{ name: '10th percentile', type: 'line', color: '#3D9200', marker: { symbol: 'square' }, } ] }); <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/highcharts-3d.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/highcharts-more.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> Box Plot Charts --> <div id="pdfContentHolder" style="margin:auto; width: 720px; height: 800px;"> <div id="container" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto" > </div> </div> https://jsfiddle.net/hew8nq5u/ Thanks in advance guys!
Currently it's not possible in Highcharts to have box bottom and top in different colors. Same with top and bottom whiskers. Here is an explanation and enhancement proposition from github issue (https://github.com/highcharts/highcharts/issues/6796): Currently each box is a single SVG shape and a border is applied by stroke parameter which cannot be "separated" for smaller edges. As a result, you can apply only single color. Your goal requires a rebuild core of boxplot, so we cannot threat it as a bug, but feature request.
how to customize vAxis gridlines become dash with google API
I'm trying to customize vAxis gridlines become dash. But, it didn't run very well, everytime I change stroke-dasharray value in css it still blur. please, is someone know how to change vAxis gridline into dash? google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawBasic); function drawBasic() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ ['Mushrooms', 3], ['Onions', 1], ['Olives', 1], ['Zucchini', 1], ['Pepperoni', 2] ]); var options = { width:'100%', focusTarget: 'category', backgroundColor: 'transparent', chartArea: { left: 20, top: 10, width: '100%', height: '70%' }, bar: { groupWidth: '70%' }, hAxis: { textStyle: { fontSize: 9, color:'#929496' } }, vAxis: { baselineColor: '#e6e6e6', gridlines: { color: '#e6e6e6', count: 9 }, textStyle: { fontSize: 9, color:'#929496' } }, legend: { position: 'bottom', textStyle: { fontSize: 9, color:'#929496' } }, animation: { duration: 300, easing: 'out', startup: true } }; var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); chart.draw(data, options); } #chart_div svg > g:nth-child(3) > g:nth-child(2) > g:first-child rect{ fill: none; stroke-width: 1; stroke: #ddd; stroke-dasharray: 5 5; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <div id="chart_div"></div>
Google Charts hAxis tooltip
I'm using Google Charts. I'm trying to display 15 stores and the number of clicks on each one. Now that's is working perfectly. My issue here is in the hAxis. As you can see the stores' names are incomplete, which is fine, but when i hover on an incomplete name, the tooltip is showing me an empty yellow box as shown in the picture below. If i select the context of this tooltip, then i can read the full name: My question is: Is it possible to change the text color in this tooltip in order to read it? Thanks.
to modify the axis tooltip, you can modify the following css classes... .goog-tooltip { background-color: cyan; color: magenta; font-weight: bold; } .goog-tooltip > div { background-color: lime !important; } see following working snippet... google.charts.load('current', { callback: drawChart, packages: ['corechart'] }); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Year'); data.addColumn('number', 'Q1'); data.addColumn('number', 'Q2'); data.addColumn('number', 'Q3'); data.addColumn('number', 'Q4'); data.addRow(['January 2016', 500, 100, 1200, 1000]); data.addRow(['February 2016', 500, 100, 1975, 1000]); data.addRow(['March 2016', 500, 100, 1200, 1000]); data.addRow(['April 2016', 500, 100, 1200, 1000]); // find v-axis max value var vAxisMax = null; for (var i = 1; i < data.getNumberOfColumns(); i++) { var range = data.getColumnRange(i); vAxisMax = vAxisMax || Math.ceil(range.max / 1000) * 1000; vAxisMax = Math.max(vAxisMax, Math.ceil(range.max / 1000) * 1000); } // add buffer for annotation vAxisMax += 400; var options = { backgroundColor: '#000000', chartArea: { top: 12, bottom: 24, left: 72 }, legend: { position: 'none' }, colors: ['#9427E0'], hAxis: { slantedText: true, textStyle: { color: '#ffffff' } }, vAxis: { title: 'Amount', viewWindow: { max: vAxisMax } }, bar: { groupWidth: '90%' }, annotations: { style: 'point', alwaysOutside: true }, width: 1100, height: 300 }; var view = new google.visualization.DataView(data); view.setColumns([ 0, 1, { calc: "stringify", sourceColumn: 1, type: "string", role: "annotation" }, 2, { calc: "stringify", sourceColumn: 2, type: "string", role: "annotation" }, 3, { calc: "stringify", sourceColumn: 3, type: "string", role: "annotation" }, 4, { calc: "stringify", sourceColumn: 4, type: "string", role: "annotation" } ]); var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); chart.draw(view, options); } .goog-tooltip { background-color: cyan; color: magenta; font-weight: bold; } .goog-tooltip > div { background-color: lime !important; } <script src="https://www.gstatic.com/charts/loader.js"></script> <div id="chart_div"></div>
Try slantedTextAngle hAxis: {direction:1, slantedText:true, slantedTextAngle:90 },
HighCharts-Removing the padding for a bar chart
I am constructing a progress-bar using bar chart(with percentage stacking) and would like to remove the spaces/padding in the container and keep only the bar without any padding/margin spaces in the chart container. Is there a way of accomplishing this? Fiddle Code: $(function () { var chart; $(document).ready(function () { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'bar' }, legend: { enabled: false, }, title: { text: '' }, xAxis: { lineWidth: 0, labels: { enabled: false }, minorTickLength: 0, tickLength: 0 }, yAxis: { min: 0, title: { text: '' }, lineWidth: 0, gridLineWidth:0, lineColor: 'transparent', labels: { enabled: false }, minorTickLength: 0, tickLength: 0 }, tooltip: { enabled: false }, plotOptions: { bar: { stacking: 'percent' }, series: { pointPadding: 0, groupPadding: 0, } }, series: [{ name: 'max', data: [40], color: 'white' }, { name: 'current', data: [60], color: 'green' }] }); }); });
You can simple remove margins: chart: { renderTo: 'container', .... margin: 0 } See: http://jsfiddle.net/gRYGn/4/