score:2
Accepted answer
You have a HTML special entity character in your JavaScript code (&
which stands for &).
Try this way:
<apex:page>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin:0 auto"></div>
<script>
$(function () {
$('#container').highcharts({
title: {
text: 'Combination chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
},
labels: {
items: [{
html: 'Total fruit consumption',
style: {
left: '50px',
top: '18px',
color: (Highcharts.theme && Highcharts.theme.textColor)||'black' // remove the HTML-like "&" encoding...
}
}]
},
series: [{
type: 'column',
name: 'Jane',
data: [3, 2, 1, 3, 4]
}, {
type: 'column',
name: 'John',
data: [2, 3, 5, 7, 6]
}, {
type: 'column',
name: 'Joe',
data: [4, 3, 3, 9, 0]
}, {
type: 'spline',
name: 'Average',
data: [3, 2.67, 3, 6.33, 3.33],
marker: {
lineWidth: 2,
lineColor: Highcharts.getOptions().colors[3],
fillColor: 'white'
}
}, {
type: 'pie',
name: 'Total consumption',
data: [{
name: 'Jane',
y: 13,
color: Highcharts.getOptions().colors[0]
}, {
name: 'John',
y: 23,
color: Highcharts.getOptions().colors[1]
}, {
name: 'Joe',
y: 19,
color: Highcharts.getOptions().colors[2]
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
});
</script>
</apex:page>
I included a jQuery CDN reference too. I don't know if it's required for Highcharts or not.
Source: stackoverflow.com
Related Articles
- Uncaught SyntaxError: Unexpected token ILLEGAL in javascript
- create-react-app Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- Highchart's error : Uncaught SyntaxError: Unexpected token for
- unexpected token { in javascript
- JSON.parse: unexpected non-whitespace character after JSON data in javascript
- Optimize JavaScript DrillDown code
- JavaScript code inside TypeScript file .ts not working
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- passing formatting JavaScript code to HighCharts with JSON
- Embed javascript code in a django template
- HTML Content to Javascript Code
- Strange character in the Highstock source code
- tool that shows javascript errors in code
- Uncaught TypeError: Cannot read property '0' of undefined javascript error and with highcharts
- Repeating Javascript Code
- Errors with Highcharts/Highstock and React, unexpected token
- Unexpected token ' when generating a png chart using node-export-server
- Error: Data source must be a URL for refresh | console error | javascript | Highcharts
- Javascript Code not running in Wordpress Pages
- Highchart error Uncaught SyntaxError: Unexpected number
- Use django variable (array of elements from sqlite3 database) inside javascript embedded code
- HighCharts - invalid or unexpected token
- JavaScript Unexpected Identifier Highcharts
- "Uncaught SyntaxError: Unexpected token = " ... JavaScript/HighCharts?
- Javascript relative time 24 hours ago etc as time
- Highchart series update in javascript
- JavaScript - Export Div with SVG chart + HTML as and Image
- How can I read an Excel File with JavaScript (without ActiveXObject)
- Export Highcharts to PDF (using javascript and local server - no internet connection)
- How do I dynamically change a data point in Highcharts using JavaScript
- Highcharts - Update a series point [x,y] values?
- How to overwrite Highcharts credits default settings
- highstock: PlotlLines text legend does not work when having 2 x-axes
- Pie Highchart Chart with multiple "ring's" around it
- Facing issue while implementing error handling in Highcharts
- How to add Highchart Bar lines and lables?
- Set datetime measure unit in Highcharts
- dates cannot be shown on highcharts
- Legend Item pattern rotation or mirroring problem
- Styled Mode : Color theme for bar
- Convert SVG to an image/png using JS/PHP
- Graph sliding strangely with negativeColor activated
- HighCharts: align rotated multiline label
- How to add dots to Highcharts legend and bars?
- In Highcharts How to keep rectangle such SVG elements attached with series data but not with pixel when resize,reflow,redraw,zooming in out?
- resizing multiple highcharts in a table
- Highcharts - yAxis tickInterval to max data
- Unable to create Highchart where i can show different - different data on clicking category and series
- How to set PointIntervals per month in HighChart
- Array issue in rails and highcharts