score:1
Accepted answer
You made some syntax errors in your code, fixed version below:
$(function() {
var colors = ['#FF0000', '#FF9900', '#009900'];
var colorIterator = 0;
var chart;
$(document).ready(function() {
const json = [{"data":[30.95]},{"data":[2.38]},{"data":[66.67]}]
setTimeout(function() {
chart = Highcharts.chart('container', {
chart: {
renderTo: 'container1',
type: 'column',
height: 200,
marginRight: 25,
marginBottom: 25,
plotBackgroundColor: '#FCFFC5',
style: {
fontFamily: 'serif',
fontSize: '8px',
}
},
title: {
text: '',
x: -20,
style: {
fontFamily: 'Tahoma',
color: '#000000',
fontWeight: 'normal',
fontSize: '11px'
} //center
},
subtitle: {
text: '',
},
xAxis: {
categories: ['Detractors', 'Passives', 'Promoters'],
title: {
text: ''
}
},
yAxis: {
//reversedStacks: false,
endOnTick: false,
max: 101,
showFirstLabel: false,
lineColor: '#999',
lineWidth: 1,
tickColor: '#666',
tickWidth: 1,
tickLength: 2,
tickInterval: 10,
gridLineColor: '#ddd',
title: {
text: '',
style: {
fontFamily: 'Tahoma',
color: '#000000',
fontWeight: 'bold',
fontSize: '8px'
}
},
plotLines: [{
color: '#808080'
}]
},
credits: {
enabled: false
},
tooltip: {
formatter: function() {
return '<b>Guest responses: ' + this.y + '<br/>' + this.series.name + '</b><br/>Month:' +
this.x;
}
},
navigation: {
buttonOptions: {
verticalAlign: 'top',
y: -10,
x: -20
}
},
legend: {
enabled: false,
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 1
},
colors: [
'#FF0000',
'#FF9900',
'#009900',
],
plotOptions: {
column: {
colorByPoint: false
}
},
series: {
type: 'column',
cursor: 'pointer',
pointWidth: 30,
point: {
events: {
}
},
legendIndex: 0,
dataLabels: {
enabled: true,
color: '#000000',
align: 'center',
cursor: 'pointer',
y: -6,
format: '{y:.2f} %', // one decimal
y: -20, // 10 pixels down from the top
style: {
textShadow: false,
fontSize: '8px',
fontFamily: 'Verdana, sans-serif'
}
}
},
exporting: {
chartOptions: { // specific options for the exported image
plotOptions: {
series: {
dataLabels: {
enabled: true
}
}
}
},
fallbackToExportServer: false
},
series: json,
});
});
});
});
Source: stackoverflow.com
Related Query
- X axis tick not centering on column series in highcharts (jsFiddle)
- Highcharts series (column) names of x axis
- Highcharts column width on a time series axis
- Highcharts displays series names but missing data points from json source
- Weird character in front of Highcharts tooltip series names
- highcharts - chart names for multiple pie chart series in one chart
- Add a gap between the second and third series in a Highcharts column plot with four series displayed
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Multiple series data on HighCharts column
- Highcharts one value per series column
- Highcharts stacked column stackLabels do not show when axis is reversed
- Remove the Z Axis Column Line in Highcharts 3D
- Highcharts - how to create multiple y axis and group the data series
- Highcharts - Series tooltip doesn't work when plotting lines that zigzag on the x axis
- How to display rounded corners in a highcharts column on a Y Axis that starts above 0
- Highcharts datetime axis overlap with a long time series
- Highcharts - stacked column - order series index dynamically for each category
- Set series color based on X axis on a column Highchart
- how to show column and area charts with different y axis with same category and same x axis in highcharts
- Highcharts - Stacked column data series
- Highcharts: Dual axis line and column with multiple series
- Highcharts Combination Chart: Column covering line series marker
- Highcharts series names in datalabel
- Use Series names as xAxis in Highcharts
- Highcharts adding additional series and axis breaks existing yAxis min/max
- Highcharts Polar Chart - Specify Data Series & Tooltips for each Axis
- HighCharts column chart populated with series data from a function
- Highcharts single horizontal stacked bar chart with data names (labels) and %-ages always shown and data numbers and series name shown on mousehover
- Highcharts drilldown to pie chart - Clicking on axis label with multiple series causes pie charts to overlap
- Highcharts - three series using left Y axis and the fourth using the right Y axis
More Query from same tag
- Load Unknown Number of Charts with Django Chartit
- How can I get a data label in my Highcharts Pie Chart that is a font-awesome icon?
- Stock tools interacting with another chart/component
- Highchart doesn't show the graph : error adding javascript array in series
- Can't set subtitle width in Highcharts
- Reload Highchart with AJAX more smoothly
- How to remove the decimal .00 from the default highcharts configuration?
- Create vertical lines for an interval using highstocks
- How to show correctly ticks to time data in a Pie chart label using highcharts?
- Highcharts custom pattern fill shows different stroke width
- "Extend" highcharts chart add properties and functions, prototype
- highcharts export server js script error codes
- Highchart Semi Circle With Gauge Chart. Shrink pie chart and move gauge up
- Can we have tickposition both outside and inside in highcharts?
- Getting the actual nth-of type position of last-of-type
- HighCharts Angular -Show noData if the data series is empty
- Highcharts tooltips with all items in category listed
- Highchart is not working on Google chrome
- Highcharts not responsive for all series in chart
- Highcharts (ng2-highcharts) gauge in Ionic
- javascript Highcharts object as a C# class
- how to remove extra data point from x-axis in highcharts
- Setting Highcharts x axis label's width
- Categories overlaps when export the chart
- Highcharts:Add image to legend
- jQuery ajax call inside ajax response returning HTML rather than JSON
- How to remove space in between bars in HighCharts bar chart?
- Highstock smooth panning
- Pie chart legend shows empty values
- Highcharts. Dynamic labels inside donut chart on mouseOver