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 Query
- 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
More Query from same tag
- Is this a bug in JSFiddle and Codepen, or in Highcharts, or a limitation of Javascript?
- rCharts HighCharts how to color zones
- Rendering Mathjax in Highcharts
- How can I do a padding between my highest x-value and the plot's right gap in Highcharts?
- On HighMaps, how do I show state abbreviations instead of state name on a U.S. map and remove data label from point
- Highcharts: how to change "overscroll" parameter on "afterSetExtremes" even?
- Custom map with Highmaps adding mappoint series in latitude and longitude using proj4js
- Highcharts large treemap How do I get the clicked node data?
- HighCharts legend.value and legend.percent items to 2 decimal points Math.Round()
- Highcharts - getting all values scrollable after setting min-max range
- Moving Average Line in Highcharts Scattered Chart
- clip path in highcharts chart makes line invisible
- My Highcharts graph with multiple axis ignores the max value I set for the first yaxis
- HighCharts stacked column chart : 'plotOptions.series.stacking' are incompatible types
- Highcharts - Y axis always visible (even after horizontal scrolling)
- how to convert svg to png image in internet Explorer?
- Highcharts grouped bar charts with multiple axes
- HighCharts JavaScript Error
- Highstock: When legend under the chart has many items, the chart height is small. How can I fix the height?
- how can I hide bottom vertical lines highcharts.js
- HighChart timestamp highlight the time now
- Highcharts synchronise range selector and navigator on 3 charts
- Highcharts won't display data
- Highcharts gem not working
- Highchart multiple level drilldown click event get drilldown series data
- Comparing percentage with Highstock
- How to format yaxis value with millions and billion initial letter in Highcharts?
- Highcharts datalabels Float Number including Zero after dot: x.0 not only x (exact decimals as in inputdata)
- Highcharts X-Axis New Values
- Highchart (stockchart) Yaxis on opposite side miss align when left axis is not visible