Labels on bar chart missing - highcharts

How do I go about ensuring that all of the labels for the bars are visible? This chart is showing every other label. Notice as well, that the numeric labels are missing on every other bar as well. Is this a font size issue, or something else?
http://jsfiddle.net/brookssh/a0xdsc3q/
var chart = new Highcharts.Chart({
chart: {
renderTo: "chartContainer",
defaultSeriesType: 'bar',
height: 595
},
title: {
text: '18 York Street Consumption (RankIt)',
style: {
color: '#484a4a',
fontSize: '22px',
fontFamily: 'Arial, Helvetica, sans-serif',
fontWeight: 'bold'
}
},
subtitle: {
text: 'Saturday, August 15 2015 through Sunday, August 16 2015'
},
credits: {
enabled: false
},
yAxis: {
allowDecimals: false,
title: {
text: "Test",
style: {
color: '#0063A2',
fontFamily: 'Arial, Helvetica, sans-serif',
fontWeight: 'bold'
}
},
plotLines: [{
color: 'red', // Color value
value: null, // Value of where the line will appear
width: 2 // Width of the line
}],
min: 0
},
xAxis: [{
categories: ['9th Floor Total kWh', '9th Floor', '8th Floor Lighting Total kWh', '8th Floor', '7th Floor Lighting Total kWh', '7th Floor', '6th Floor Total kWh', '5th Floor Total kWh', '5th Floor', '4th Floor Total kWh', '4th Floor', '3rd Floor Total kWh', '3rd Floor', '26th Floor Total kWh', '26th Floor', '25th Floor Total kWh', '25th Floor', '24th Floor Total kWh', '24th Floor', '23rd Floor Total kWh', '23rd Floor', '22nd Floor Total kWh', '22nd Floor', '21st Floor Total kWh', '21st Floor', '20th Floor Total kWh', '20th Floor', '19th Floor Total kWh', '19th Floor', '18th Floor Total kWh', '18th Floor', '17th Floor Total kWh', '17th Floor', '16th Floor Total kWh', '16th Floor', '15th Floor Total kWh', '15th Floor', '14th Floor Total kWh', '14th Floor', '13th Floor Total kWh', '13th Floor', '12th Floor Total kWh', '12th Floor', '11th Floor Total kWh', '11th Floor', '10th Floor Total kWh', '10th Floor'],
title: {
},
type: 'category',
plotBands: [{
color: '#DDECFF',
from: 1439571600000,
to: 1439744400000
}],
plotLines: [{
color: 'grey', // Color value
dashStyle: "dash",
value: null, // Value of where the line will appear
width: 0 // Width of the line
}],
}, {
labels: {
rotation: -45,
enabled: false
},
lineWidth: 0,
}],
exporting: {
enabled: false
},
legend: {
enabled: false
},
plotOptions: {
series: {
colorByPoint: true
},
spline: {
enableMouseTracking: true,
animation: {
duration: 1500
},
marker: {
enabled: false,
states: {
hover: {
enabled: true,
symbol: 'circle',
radius: 5,
lineWidth: 1
}
}
}
}
},
tooltip: {
yDecimals: 2,
formatter: function () {
return tooltipFormat(this.x, null, this.y, yAxisTitle);
}
},
series: [{
data: [157, 169, 159, 173, 194, 203, 178, 144, 155, 411, 421, 275, 288, 266, 400, 214, 225, 142, 158, 112, 124, 114, 130, 112, 127, 134, 150, 107, 124, 143, 158, 85, 103, 99, 123, 174, 191, 327, 365, 221, 237, 241, 255, 310, 370, 133, 145],
dataLabels: {
enabled: true,
color: '#000',
style: {
fontSize: '10px',
verticalAlign: 'middle'
}
}
}]
});

You can use allowOverlap attribute of plotOptions.series.dataLabels to force the display of each labels :
plotOptions: {
series: {
colorByPoint: true,
dataLabels: {
allowOverlap: true
}
},
/* ... */
}
See your working JSFiddle here.

Related

Bar chart in High chart for indication of value with two colors in each bar where one color is always kept fixed

I am working on a project and I would like to use bar chart(HighChart) to indicate values. I prefer to use bar chart of this kind-
bar chart image
If any one have worked on this type of bar chart or have any idea of how to implement it, please share. Thanks in advance.
Set axis min max and then create an additional series which will complete the first series data to the axis max. For the additional, dummy series set options like enableMouseTracking or showInLegend to false so it wont inteact with the user.
yAxis: {
min: 0,
max: 700
},
plotOptions: {
series: {
grouping: false,
borderWidth: 0
}
},
series: [{
enableMouseTracking: false,
linkedTo: 1,
data: [{
y: 700,
color: 'rgba(66, 134, 244, 0.5)'
}, {
y: 700,
color: 'rgba(206, 49, 28, 0.5)'
}]
}, {
dataLabels: {
enabled: true,
style: {
fontSize: '20px',
textOutline: null
}
},
data: [{
y: 107,
color: 'rgba(66, 134, 244, 1)'
}, {
y: 31,
color: 'rgba(206, 49, 28, 1)'
}]
}]
example: http://jsfiddle.net/sL5bpep3/

highcharts how to divide axis into 2

I have 2 axis both on the same side, they are both taking up the entire axis and so the labels are overlapping and the graphs are crossing. What I'd like is to allocate 2/3 of the the space on top for the first series and 1/3 for the 2nd, so graphically looks like
|-
|
|
|
|
|-
|
|
|-
The values could be anything for either series, point is they only have a certain amount of the graph to work with. Any way to achieve this?
yAxis: [
{
offset: -6,
title: {
text: 'two',
align: 'high',
rotation: 0,
offset: 8,
y: -6,
x: 20,
style: {
fontSize: '7px'
}
},
plotLines: [{
value: 0,
color: 'orange',
width: 1,
zIndex: 5,
dashStyle: 'Solid'
}],
opposite: true,
//minorGridLineColor: 'green',
gridLineColor: 'black'
},
{
offset: -6,
title: {
text: 'one',
align: 'high',
rotation: 0,
offset: 8,
y: -6,
x: 20,
style: {
fontSize: '7px'
}
},
plotLines: [ {
value: 0,
color: 'orange',
width: 1,
zIndex: 5,
dashStyle: 'Solid'
}],
opposite: true,
gridLineColor: 'black'
}

Highcharts - doughnut charts, gap when only one point in series

At the top of doughnut charts with only 1 point in the series, there is always a tiny gap between the start and end of the slice:
http://jsfiddle.net/6E2Bx/
credits: {
enabled: false
},
chart: {
plotBackgroundColor: 'pink',
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'See the gap at 0 degrees',
align: 'center',
verticalAlign: 'middle',
y: 0
},
plotOptions: {
pie: {
borderWidth: 0,
dataLabels: {
enabled: true,
distance: -30,
style: {
fontWeight: 'bold',
color: 'white',
textShadow: '0px 1px 2px black'
}
},
startAngle: 0,
endAngle: 360,
center: ['50%', '50%']
}
},
series: [{
type: 'pie',
name: 'Browser share',
innerSize: '70%',
data: [
['Full', 1]
]
}
Close up of the gap:
Am I missing some setting here?
I would prefer not to modify the drawing/svg elements directly, I feel like borderWidth: 0 should be handling this.

Color grouped bars slightly different in HighCharts

I have a grouped HighCharts bar chart that is colored by group. For example all bars in group 1 are blue, group 2 is gray, group 3 is green. Now I just need to have slight variations of color within each group. So group 1 would have a dark blue bar, regular blue bar, and a light blue bar. Then group 2 would have dark gray, regular gray, and light gray. I can't figure out how to get those color variations within each group. Thanks to anyone in advance for looking into this.
$(function () {
var pWidth = 20, // points width
pPadding = 5, // point padding
gPadding = 15, // group padding
categories = ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
series = [{
name: 'Year 1800',
data: [107, 55, 635, 203, 30],
color: 'red'
}, {
name: 'Year 1900',
data: [133, 156, 550, 408, 45]
}, {
name: 'Year 2008',
data: [500, 604, 404, 632, 60]
}],
sLen = series.length,
cLen = categories.length;
var catWidth = 2 * gPadding + sLen * (pPadding + pWidth);
// 2*gPadding = left group padding + right group padding
// sLen * pPadding = distance between points
// sLen * pWidth = space taken by points itselves
// cat width = one category width/height
var height = catWidth * cLen;
var groupPadding = gPadding / catWidth;
$('#container').highcharts({
chart: {
height: height,
type: 'bar',
marginLeft: 0,
marginRight: 0,
marginTop: 0,
marginBottom: 0,
spacingTop: 0,
spacingBottom: 0,
spacingLeft: 0,
spacingRight: 0
},
title: {
text: ''
},
xAxis: {
categories: categories,
title: {
text: null,
},
labels: {
enabled: false
}
},
yAxis: {
title: {
text: null,
},
labels: {
enabled: false
}
},
plotOptions: {
bar: {
pointWidth: pWidth,
groupPadding: groupPadding
},
series: {
colorByPoint: true
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: series
});
});
Here is a fiddle.
You can specify each color in the point configuration.
Instead of:
data: [107, 55, 635, 203, 30],
Use:
data: [{y: 107, color: 'someColor'}, {y: 55, color: 'someColor'}, {y: 635, color: 'someColor'}, {y: 203, color: 'someColor'}, {y: 30, color: 'someColor'}],
Here's an updated fiddle where I've done the first group with shades of blue.

0 value column chart - highchart

How do I make a slight shadow or color come up below the x axis for zero valued points in column charts?
Right Now nothing is shown.
Setting the minPointLength property makes a line come up above the x Axis.
Any help or pointers would help.
Below are my options:
plotOptions: {
column: {
shadow: false,
pointWidth: 11.5,
borderWidth: 0.5,
enableMouseTracking: false,
minPointLength: 1
}
},
yAxis: {
labels: {
align: 'left',
style: {
color: 'gray',
fontWeight: 'normal',
fontSize: '8.5px',
fontFamily: 'Arial'
}
},
minorGridLineWidth: 1,
minorTickInterval: 10000,
minorGridLineColor: 'white',
minorTickWidth: 0,
title: {
text: '',
rotation: 270.0,
style: {
fontWeight: 'normal'
},
margin: 20,
style: {
fontWeight: 'normal',
fontFamily: 'Arial',
color: '#666666',
fontSize: '11px'
}
},
opposite: true,
min: 0,
max: 500000,
tickInterval: 100000,
gridLineWidth: 0.0
}
This gives me a 1px point above x Axis.
But what I am looking for is a small shadow/1px point below the xAxis.
The only way I have found to accomplish something like this is to convert 0 values to negative values (I have most often done something where I have a very small column that goes from -1 to 1, straddling the 0 line)
How large of a spread your data has will determine what negative value you need to specify.
http://jsfiddle.net/jlbriggs/JVNjs/307/
data: [7,12,16,-1,32,64]
{{Edit:
updated example with startOnTick:false - http://jsfiddle.net/jlbriggs/JVNjs/309/

Resources