I am trying to have combined chart to display bar charts below my 2 pie series .
I am trying to push the 3 bars below "Chart Title" and I am not being to achieve this with different parameters like grouppadding in highcharts . First I need to reduce the space between Bars to make it 10 px may be and then need to push the entire bar series after Semidonut Pie .
Anyway to achieve this ...
This is roughly the coding I have :
<HighchartWrapper
chartOptions={{
chart: {
plotBackgroundColor: null,
plotBorderWidth: 0,
plotBackgroundColor: null,
plotShadow: false,
height: 400,
width: 650,
},
tooltip: {
formatter: function () {
console.log('In tooltip:', this);
if (this.key === 'yoyfnbrev')
var txt1 = 'YOY Func Rev' + this.y;
return txt1;
},
},
plotOptions: {
pie: {
startAngle: -90,
endAngle: 90,
center: ['50%', '85%'],
size: '160%',
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
style: {
fontSize: '16px',
color: 'black',
style: {
fontFamily: "'Lato', sans-serif",
},
},
formatter: function () {
if (this.series.name === 'revthisyear')
return (
this.point.y.toFixed(0) + '%'
);
else if (this.series.name === 'revlastyear')
return this.point.y.toFixed(0) + '%';
},
},
},
},
bar: {
groupPadding: 0,
pointPadding: 0,
dataLabels: {
enabled: true,
},
},
xAxis: {
gridLineWidth: 0,
minorGridLineWidth: 0,
gridLineColor: 'transparent',
title: {
text: null,
},
labels: {
enabled: false,
},
},
yAxis: {
gridLineWidth: 0,
minorGridLineWidth: 0,
gridLineColor: 'transparent',
opposite: true,
title: {
text: null,
},
labels: {
enabled: false,
},
},
series: [
{
type: 'pie',
name: 'revlastyear',
innerSize: '40%',
data: [20,40,40],
colors: ['#1a7ead', '#e95326', '#008540'],
dataLabels: {
enabled: true,
// inside: true,
distance: -140,
},
},
{
type: 'pie',
name: 'revthisyear',
innerSize: '60%',
data: [[10, 70, 20],
colors: ['#1a7ead', '#e95326', '#008540'],
dataLabels: {
enabled: true,
// inside: false,
distance: -60,
},
},
{
type: 'bar',
name: 'yoyrev',
// innerSize: '10%',
data: [20, -100, -50],
colors: ['#1a7ead', '#e95326', '#008540'],
pointWidth: 10,
pointPadding: 0,
groupPadding: 0.3,
},
],
}}
/>
I think that a good solution will be to use independent yAxis and xAxis for this bar, set a smaller height for them and change the pie centre values. See:
xAxis: [{
gridLineWidth: 0,
minorGridLineWidth: 0,
gridLineColor: 'transparent',
title: {
text: null,
},
labels: {
enabled: false,
},
}, {
height: '20%'
}],
Demo: https://jsfiddle.net/BlackLabel/jc3fLvt1/1/
API: https://api.highcharts.com/highcharts/series.pie.center
API: https://api.highcharts.com/highcharts/series.bar.yAxis
The simplest solution is to create another chart:
Highcharts.chart('container', {
...,
series: [{
type: 'pie',
...
}]
});
Highcharts.chart('container2', {
...,
series: [{
type: 'bar',
...
}]
});
Live demo: http://jsfiddle.net/BlackLabel/r9yz6qdk/
I have created a chart with StockChart and I am trying to enlarge the cropThreshold of the serie but without success.
When I am using the HighCharts implementation then it's working as expected.
example of StockChart / HighChart:
- JSFiddle
(To see the difference between the two implementation just change line 4 with line 5)
code:
$(function() {
Highcharts.stockChart('container', {
/* Highcharts.chart({ */
chart: {
renderTo: 'container'
},
title: {
text: 'Project wise Budget Estimation'
},
navigation: {
buttonOptions: {
enabled: false
}
},
navigator: {
enabled: false
},
rangeSelector: {
enabled: false
},
credits: {
enabled: false
},
xAxis: {
tickInterval: 15 * 60 * 1000,
type: 'datetime',
min: 1530385200000,
max: 1530394200000
},
yAxis: {
min: 0,
opposite: false,
tickColor: '#95989A',
tickWidth: 1,
tickLength: 10,
visible: true,
tickInterval: 60,
title: {
text: 'Amount Distribution'
}
},
legend: {
shadow: false
},
tooltip: {
},
plotOptions: {
column: {
stacking: 'normal',
cropThreshold: 150
}
},
series: [
{
name: 'targetName',
showInLegend: true,
data: [
[1530385200000,500],[1530386100000,500],[1530387000000,500],[1530387900000,500],[1530388800000,500],[1530389700000,500],[1530390600000,400],[1530391500000,450],[1530392400000,550],[1530393300000,500],[1530394200000,650],[1530395100000,500],[1530396000000,500],[1530396900000,550],[1530397800000,500],[1530398700000,500],[1530399600000,700],[1530400500000,650],[1530401400000,800],[1530402300000,500],[1530403200000,500],[1530404100000,300],[1530405000000,250],[1530405900000,200],[1530406800000,350],[1530407700000,150],[1530408600000,770],[1530409500000,800],[1530410400000,500],[1530411300000,500],[1530412200000,500],[1530413100000,500],[1530414000000,500],[1530414900000,500],[1530415800000,500],[1530416700000,500],[1530417600000,500],[1530418500000,500],[1530419400000,500],[1530420300000,500],[1530421200000,500],[1530422100000,500],[1530423000000,500],[1530423900000,500],[1530424800000,500]
],
zIndex: 2
},
{
name: 'deviationName',
showInLegend: true,
data: [
[1530385200000,450,550],[1530386100000,450,550],[1530387000000,450,550],[1530387900000,450,550],[1530388800000,450,550],[1530389700000,450,550],[1530390600000,360,440],[1530391500000,405,495],[1530392400000,495,605],[1530393300000,450,550],[1530394200000,585,715],[1530395100000,450,550],[1530396000000,450,550],[1530396900000,495,605],[1530397800000,450,550],[1530398700000,450,550],[1530399600000,630,770],[1530400500000,585,715],[1530401400000,720,880],[1530402300000,450,550],[1530403200000,450,550],[1530404100000,270,330],[1530405000000,225,275],[1530405900000,180,220],[1530406800000,315,385],[1530407700000,135,165],[1530408600000,693,847],[1530409500000,720,880],[1530410400000,450,550],[1530411300000,450,550],[1530412200000,450,550],[1530413100000,450,550],[1530414000000,450,550],[1530414900000,450,550],[1530415800000,450,550],[1530416700000,450,550],[1530417600000,450,550],[1530418500000,450,550],[1530419400000,450,550],[1530420300000,450,550],[1530421200000,450,550],[1530422100000,450,550],[1530423000000,450,550],[1530423900000,450,550]
],
type: 'arearange',
linkedTo: ':previous',
zIndex: 0
},
{
name: 'periodsName',
showInLegend: false,
type: 'column',
cropThreshold: 150,
zIndex: 1,
pointInterval: 24 * 3600 * 1000,
data: [
{"x":1530385200000,"y":400,"colorIndex":55},{"x":1530386100000,"y":400,"colorIndex":55},{"x":1530387000000,"y":400,"colorIndex":55},{"x":1530387900000,"y":480,"colorIndex":56},{"x":1530388800000,"y":495,"colorIndex":56},{"x":1530389700000,"y":510,"colorIndex":56},{"x":1530390600000,"y":700,"colorIndex":57},{"x":1530391500000,"y":650,"colorIndex":57},{"x":1530392400000,"y":300,"colorIndex":55},{"x":1530393300000,"y":660,"colorIndex":57},{"x":1530394200000,"y":400,"colorIndex":55},{"x":1530395100000,"y":500,"colorIndex":56},{"x":1530396000000,"y":500,"colorIndex":56},{"x":1530396900000,"y":200,"colorIndex":55},{"x":1530397800000,"y":490,"colorIndex":56},{"x":1530398700000,"y":500,"colorIndex":56},{"x":1530399600000,"y":400,"colorIndex":55},{"x":1530400500000,"y":300,"colorIndex":55},{"x":1530401400000,"y":200,"colorIndex":55},{"x":1530402300000,"y":500,"colorIndex":56},{"x":1530403200000,"y":480,"colorIndex":56},{"x":1530404100000,"y":670,"colorIndex":57},{"x":1530405000000,"y":755,"colorIndex":57},{"x":1530405900000,"y":680,"colorIndex":57},{"x":1530406800000,"y":710,"colorIndex":57},{"x":1530407700000,"y":670,"colorIndex":57},{"x":1530408600000,"y":400,"colorIndex":55},{"x":1530409500000,"y":400,"colorIndex":55},{"x":1530410400000,"y":500,"colorIndex":56},{"x":1530411300000,"y":400,"colorIndex":55},{"x":1530412200000,"y":510,"colorIndex":56},{"x":1530413100000,"y":400,"colorIndex":55},{"x":1530414000000,"y":490,"colorIndex":56},{"x":1530414900000,"y":400,"colorIndex":55},{"x":1530415800000,"y":400,"colorIndex":55},{"x":1530416700000,"y":590,"colorIndex":57},{"x":1530417600000,"y":590,"colorIndex":57},{"x":1530418500000,"y":600,"colorIndex":57},{"x":1530419400000,"y":620,"colorIndex":57},{"x":1530420300000,"y":400,"colorIndex":55},{"x":1530421200000,"y":600,"colorIndex":57},{"x":1530422100000,"y":600,"colorIndex":57},{"x":1530423000000,"y":600,"colorIndex":57},{"x":1530423900000,"y":400,"colorIndex":55},{"x":1530423000000,"y":600,"colorIndex":57},{"x":1530423900000,"y":400,"colorIndex":55},{"x":1530423000000,"y":600,"colorIndex":57},{"x":1530423900000,"y":400,"colorIndex":55},{"x":1530423000000,"y":600,"colorIndex":57},{"x":1530423900000,"y":400,"colorIndex":55}
]
},
{
name: 'withinTarget',
type: 'column',
showInLegend: true,
data: []
},
{
name: 'belowTarget',
type: 'column',
showInLegend: true,
data: []
},
{
name: 'overTarget',
type: 'column',
showInLegend: true,
data: []
}],
scrollbar: {
enabled:true,
/* liveRedraw: false, */
barBackgroundColor: 'gray',
barBorderRadius: 7,
barBorderWidth: 0,
buttonBackgroundColor: 'gray',
buttonBorderWidth: 0,
buttonArrowColor: 'yellow',
buttonBorderRadius: 7,
rifleColor: 'yellow',
trackBackgroundColor: 'white',
trackBorderWidth: 1,
trackBorderColor: 'silver',
trackBorderRadius: 7
}
});
});
This behavior is caused by dataGrouping, you can disable it. It is also worth noting that you have unsorted data.
plotOptions: {
series: {
stacking: 'normal',
cropThreshold: 150,
dataGrouping: {
enabled: false
}
}
}
Live example: http://jsfiddle.net/BlackLabel/2ma3yhv1/
API Reference: https://api.highcharts.com/highstock/plotOptions.series.dataGrouping.enabled
I have the charts of lib HighCharts and I want to remove the gridline of yAxis on charts
I write gridLineWidth: 0
but gridlines are not removing
All code:
<script type="text/javascript">
(function($){ // encapsulate jQuery
$(function() {
Highcharts.setOptions({
lang: {
rangeSelectorZoom: 'Маcштаб',
rangeSelectorFrom: 'От',
rangeSelectorTo: 'До',
thousandsSep: ' '
},
global: {
useUTC: false
}
});
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart : {
borderColor: 'white',
renderTo : <?php echo "cont".$i; ?>,
backgroundColor: '#f9f9f9' // Сделаем слегка серый фон
},
rangeSelector: {
buttons: [
{
type: 'week',
count: 1,
text: 'Неделя',
},
{
type: 'month',
count: 1,
text: 'Месяц',
},
{
type: 'year',
count: 1,
text: 'Год'
},
{
type: 'all',
text: 'Всё'
}],
inputDateFormat: '%d.%m.%Y', // Меняем на привычный для нас формат даты в интервалах
inputEditDateFormat: '%d.%m.%Y',
buttonTheme: {
width: 43 // Увеличим ширину кнопки
},
selected: 1 // Какая кнопка выбрана по умолчанию
},
yAxis: [{
gridLineWidth: 0,
plotBands: [{
color: 'rgba(1, 143, 189, 1)',
from: -2,
to: 11
},
{
color: 'rgba(157, 200, 5, 1)',
from: 11,
to: 21
},
{
color: 'rgba(202, 1, 94, 1)',
from: 21,
to: 50
}],
title: {
text: 'Позиции'
},
startOnTick: false,
// min: 1,
showFirstLabel: true,
showLastLabel: true,
reversed: true,
tickPositioner: function(min, max) {
// specify an interval for ticks or use max and min to get the interval
var interval = Math.round((max-min)/5);
// push the min value at beginning of array
var dataMin=this.dataMin;
var dataMax=this.dataMax;
var positions = [dataMin];
var defaultPositions = this.getLinearTickPositions(interval, dataMin, max);
//push all other values that fall between min and max
for (var i = 0; i < defaultPositions.length; i++) {
if (defaultPositions[i] > dataMin && defaultPositions[i] < dataMax) {
positions.push(defaultPositions[i]);
}
}
// push the max value at the end of the array
positions.push(dataMax);
return positions;
},
//changed min valuereversed: true
}],
navigator: {
enabled: false,
maskFill: 'rgba(255, 255, 255, 0.45)',
//margin: 20,
series: {
type: 'areaspline',
color: 'rgba(255, 255, 255, 0.00)',
fillOpacity: 0.4,
dataGrouping: {
smoothed: false
},
lineWidth: 2,
lineColor: '#e9cc00',
marker: {
enabled: false
},
shadow: true
},
yAxis: {
reversed: true
}
},
xAxis : {
gridLineWidth: 0,
type: 'datetime',
title : {
text : ' '
},
},
title : {
//text : 'Позиции сайта'
},
legend: {
enabled: true,
align: 'center',
itemWidth: 234, // указал ширину, чтобы выводились сайты в 4 колонки
verticalAlign: 'top'
},
series : [{
lineColor: 'white',
name : 'Позиция в яндексе',
id : 'dataseries',
data : <?php echo $d ?>,
tooltip: {
backgroundColor: 'rgba(250, 250, 250, .85)', // Фон немного темнее
borderColor: 'rgba(100, 100, 100, .90)', // Цвет границы (по умолчанию меняется автоматом)
xDateFormat: '%d.%m.%Y %H:%M', // Наш формат даты
// Тут немного увеличиваем размер даты
headerFormat: '<span style="font-size: 12px">{point.key}</span><br/>',
// Формат надписей в подсказке, названия цветом графика, а значения жирным
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',
//valueDecimals: 2
}
}]
});
});
});
})(jQuery);
</script>
The problem is not the gridLineWidth. You've set that correctly.
In addition you need to set the minorGridLineWidth that you have to set to 0
Working demo
If you doesn't want to touch the config object, you just hide the grid by css:
.chart-container .highcharts-grid {
display: none;
}
you just need to gridLineWidth set to 0
yAxis: {
min:0,
categories: ["","Low","Medium","High"],
tickWidth: 0,
crosshair: false,
lineWidth: 0,
gridLineWidth:0,//Set this to zero
title: '',
labels: {
formatter: function () {
return this.value;labels
}
},
showEmpty: false
}
None of the mentioned solutions worked for me, so this one finally worked (taken from Sparklines examples: https://www.highcharts.com/demo/sparkline):
yAxis: {
startOnTick: false,
endOnTick: false,
tickPositions: [],
}
for all other lines here is what worked for me, in some cases using line transparency as the color was the only solution I could find.
$(function() {
$('#container').highcharts({
colors: ['#00f900', '#ffff3c', '#ff2600'],
credits: {
enabled: false
},
exporting: {
enabled: false
},
legend: {
itemDistance: 60
},
lineColor: 'red',
chart: {
type: 'column',
backgroundColor: 'transparent'
},
title: {
text: ''
},
legend: {
itemStyle: {
color: 'white',
fontWeight: 'normal',
fontFamily: 'helvetica',
fontSize: '12px'
}
}
// ....rest in js fiddle
http://jsfiddle.net/fv50sLkj/23/