You must be logged in to post your query.
Home › Forums › Report Bugs › canvasjs dose not work in phonegap
I build hybrid app using phonegap. in the html site my canvasJS chart works perfect, but when i build my app with phonegap my chart isn’t work – i cant see it.
this is my HTML code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tech-care</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js"></script>
<script src="jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
<script src="../js/script.js"></script>
<script src="../js/jquery.js"></script>
<script>$('#widget').draggable();</script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="js/jquery.canvasjs.min.js" type="text/javascript" ></script>
<script type="text/javascript" src="../cordova.js"></script>
<script src="../js/index.js"></script>
<link rel="stylesheet" href="../styles/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1" charset="utf-8">
</head>
<body onload="app.initialize();">
<div id="wrapper">
<header class="headerHome">
<a href="mainScreen.html"></a>
<ul class="navCover">
<li onclick="showmenu(this)" class="navMenu">
<ul>
<li><a href="reports.html"><span class="reportsText">Reports</span></a></li>
<li><a href="profiles.html"><span class="profilesText">Profiles</span></a></li>
<li><a href="#"><span class="settingsText">Settings</span></a></li>
<li><a href="#"><span class="logoutText" onclick="logout()">Log Out</span></a></li>
</ul>
</li>
</ul>
</header>
<main class="pagesMain">
<section class="analyzeMainTitle generalFormTextR">Events analysis</section>
<section class="analyzeSubTitle generalFormTextB">Month classification</section>
<section id="chartContent" class="chartContent"></section>
</main>
<footer></footer>
</div>
</body>
</html>
<script src="../js/analyze.js"></script>
This is my js code:
function showmenu(elem) {
// Clear any currently open menu
var openMenu = document.getElementById("activeMenu");
if (openMenu) {
openMenu.removeAttribute("id");
if (openMenu === elem) {
return;
}
}
// Only apply it if the element actually has LI child nodes.
// OPTIONAL: Will still work without if statement.
if (elem.getElementsByTagName("li").length > 0) {
elem.setAttribute("id", "activeMenu");
}
}
$(window).on("load" ,function () {
$.getJSON("http://liorha.mtacloud.co.il/tech-care/analyzeController.php", function (result) {
var chart = new CanvasJS.Chart("chartContent", {
type: "column",
backgroundColor: null,
axisY: {
gridThickness: 0
},
data: [
{
color: "#be1e2d",
dataPoints: result
}
]
});
chart.render();
});
});
function logout(){
$.post( "http://liorha.mtacloud.co.il/tech-care/mainScreenCotroller.php", { handle: "logout" })
.done(function( data ) {
if (data.match("success")){
window.open("../index.html",'_self');
}
});
}
What am i missing here? Tnx.
You must be logged in to reply to this topic.