score:7
Accepted answer
jQuery Mobile is unique when used wihh other js drawing frameworks. They can only be used with a pageshow event.
One more thing, remember to initialize HighCharts after jQuery Mobile has been initialized.
Here's a working example: http://jsfiddle.net/Gajotres/Eg9Xz/
HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
<a href="#second" class="ui-btn-right">Next</a>
</div>
<div data-role="content">
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
</body>
</html>
Javascript :
$(document).on('pageshow', '#index', function(){
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': '+ this.y +'°C';
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
}, {
name: 'New York',
data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
}, {
name: 'Berlin',
data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
}, {
name: 'London',
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
}]
});
});
});
Source: stackoverflow.com
Related Query
- Showing HighCharts in A JQuery Mobile application
- JQuery mobile and highcharts integration
- Highcharts in JQuery Tabs - Resizing hidden tab code stops resizing visible tab
- Using Highcharts JS in native mobile application
- Highcharts and jQuery Mobile Pages
- Highcharts with JQuery mobile Black display
- Dynamically changing Highcharts Theme through Jquery code not working
- Highcharts chart option backgroundColor:'transparent' showing black on IE 8
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- Highcharts jQuery rendering problem - all browsers
- Rounding results in highcharts jquery script
- Loading Highcharts via shim using RequireJS and maintaining jQuery dependency
- jQuery UI Tabs and Highcharts display/rendering issue
- Highcharts Error #16: charts not showing on the same page
- rCharts with Highcharts as shiny application
- Highcharts / jQuery - destroy and rebuild chart with original options
- Highcharts - Keep tooltip showing on click
- Always showing tooltip on all columns in Highcharts
- highcharts jquery dynamic change chart type column to bar
- Highcharts Pie Chart Drilldown not showing on third drill
- jQuery datepicker with Highstocks / Highcharts
- jquery calling highcharts generating error 17
- Why are the labels for my opposite yaxis in Highcharts not showing up?
- Loading Highcharts series from XML using jQuery
- Highcharts line chart tooltips not showing correctly?
- Highcharts spline chart points not showing unless zoomed in
- Highcharts : Showing wrong color in data series
- Highcharts zoom issue after upgrading to jQuery 1.8
- Highcharts showing nearest point causes flickering crosshair and strange order
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
More Query from same tag
- angular2-highcharts x axis moves up on drilldown
- HighChart with large amount of data not working
- Highcharts tooltip on IE9
- Colum Highchart
- Highcharts: show stack total in shared tooltip, via footerFormat property
- When trying to display a chart using ChartIt, Error saying template does not exist arises
- How to use a different formatter on Highcharts in each curve of the same graphic?
- Highcharts: change line options mid-way through a line
- Display JavaScript Date in X axis in hightcharts
- HighCharts does not recognize a function of Legend
- highstocks x-axis time incorrect
- How to change the line color of a bubble in highcharts dynamically
- Assigning JSON value to a Variable that Resides Outside JavaScript Function
- Highstocks - Use tickmarkPlacement "between" on datetime Axis (no categories)
- Clickable Pie chart to select data for bar chart
- highcharts no point markers but show single point or discontinous points
- How to customise the highcharts plot in R
- It's not possible load Highstock from the CDN as an AMD module
- Highchart multi Yaxis in one line
- how to display array of objects in High stock charts
- Setting Highcharts styledMode: true fails to load CSS
- How to make rectangular legend in highcharts?
- Highcharts:Column Range chart having height of bar same as the height of interval in y Axis
- Trying to update high chart data
- Plot always starts at 0, highstock spline chart
- Why mistake appears during render?
- How to get different colors for every column in a stacked column chart
- States Not Working on Highmaps mappoint click
- How to make buttons filter different data based on a category they select in Highcharts heatmap?
- How to create such pie chart/ donut chart in highchart?