score:10
I believe your problem is in the order you included the scripts. Try placing jQuery first:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
Demo (working / not working).
Update: to load your data from MySQL using PHP, please see this example. However, as you pointed out yourself, encoding it using JSON might be a better option:
$data = array();
while($row = mysql_fetch_array($results)) {
$data[] = array($row[1], $row[0]);
}
echo json_encode($data);
This last echo
can be used either to return the whole array using ajax (like the linked example above), or when generating the page itself (i.e. "hardcoding" it in the script):
series: [{
type: 'pie',
name: 'Browser share',
data: <?php echo json_encode($data)?>
}]
This will work since your array, when JSON encoded, can be used in place of a JavaScript literal (and the json_encode
should take care of escaping everything, preventing XSS vulnerabilities).
score:5
The order of including javascripts should be:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
By this I mean, you have to include the jQuery library first before any other script.
Source: stackoverflow.com
Related Query
- Highcharts not displaying anything just blank html page
- How to export the whole page or html content with Highcharts not just the chart?
- Highcharts is not displaying in the div at all, resulting in a blank page - Using python flask and jinja template?
- Highcharts graph not displaying in Django template html
- highcharts download not working from html page with iframe in IE
- Highcharts Error #16: charts not showing on the same page
- Highcharts not displaying data labels for Pie chart in arabic
- Highcharts not displaying data at some zoom levels
- highcharts graphs in bootstrap tabs are not displaying properly
- Highcharts stacking bar chart border not displaying on right side
- Using highcharts with rails not displaying plotLines
- Last y-axis label not displaying on highcharts spiderweb
- Highcharts - Multiple Axis Graph not displaying labels
- Highcharts not displaying series data for graph with multiple Y-axes
- highcharts display in my render html page which i want to convert into PDF using wkhtmltopdf in rails
- Highcharts JSON, chart not displaying
- Highcharts not displaying in Firefox
- HighCharts Solid Gauge Chart not displaying ticks
- HighCharts x-axis not displaying correctly
- Highcharts export not displaying correctly
- Highcharts of type area range not displaying markers like circles
- Highcharts Not displaying function's data values
- Highcharts Column Chart Not Displaying Dynamic Values
- Uncaught TypeError: $(...).highcharts is not a function in aspx web page with master page but it is working with basic html page
- Highcharts not rendering labels from an html table
- Highcharts display label for pie chart using html table as data source
- highcharts not refreshing chart when page refreshes
- Multiple "Script src" on same page causing sorting functions not to work on HighCharts
- highcharts x-axis not showing with series of just one value
- JavaScript - Highcharts box plot not displaying
More Query from same tag
- highcharts xAxis limit how far zoom in
- How to create constant space between bars/columns in Highcharts?
- Parse an array in js
- Binding empty array to chart
- With mulitiple boxplots/median trend line series', line points don't line up with boxplot
- How to make a black-and-red line in highcharts
- highcharts not given the right xAxis labels on page load
- how to assign date time to highchart with intervals and date start
- Complicated Rails query for reports with missing data
- Total valued figures often overlapping with bars in Highcharts Barchart
- Highcharts stock chart not showing up with custom data
- Pie chart slice radius using HighCharts library
- Combine PieChart with Map
- Highcharts animate series on show
- Datepicker jquery-ui for angular highcharts-ng rangeSelector
- How to call a css properties inside plotLines in highcharts
- Highchart extend x-axis and then update y-axis data
- Highchart Legend's Border
- Highchart property 'name' does not exist on type 'LegendOptions'
- How to set new data then reverse to original data in Highcharts?
- How to convert a JavaScript object to array
- Highcharts: Chart does not resize properly by making the screen smaller
- How to render a specific data point marker on HightCharts Bell Curve?
- How to draw an outer border for a donut chart - Highcharts
- Which one is better to represent an API fetched data in react js and please explain how to do that?
- Highchart Callback Refactoring not working, and how to display multiple series using multiple Ajax data
- Modifying value returned from a method in Scala (Highcharts lib)
- Last y-axis label not displaying on highcharts spiderweb
- highcharts column animation when adding point (series.addPoint())
- Adding stacklabels to highcharts-ng