$(function () {
//load graph also on click of app
$("#drpApp").on("change",function(e){
loadGraph();
});
//using delegate to attach on change radio event to
$("#rangeSel").on("change","input:radio",function(e) {
console.log(e.target.value);
loadGraph();
});
loadGraph();
});
// function load graph here
function loadGraph()
{
var selapp = $("#drpApp").val();
var selrange = $("input[name=chart1]:checked").val();
var grphtitle = $("#drpApp option:selected").text();
var grphtxt = $("input[name=chart1]:checked").attr("data-value");
console.log(grphtxt);
var graphData;
// below data would come from mysql db
// table structure would be like as below arrays
// 5 tables (daily,weekly,monthly,objective monthly,yearly) for one app
var cared = [
["10-5-2014", 29.9],
["11-10-2014", 51.5],
["12-12-2014", 16.4]
]
var carew = [
["week 10", 10],
["week 23", 20.5],
["week 40", 86.4]
]
var carem = [
["Jan", 5],
["Feb", 60.5],
["Dec", 16.4]
]
var careom = [
["Jan", 15],
["Feb", 20.5],
["Dec", 1.4]
]
var carey = [
["2010", 15],
["2014", 20.5],
["2015", 1.4]
]
//selecting appropiate data based on selection
switch(selapp)
{
case "care" : switch (selrange) { case 'd': graphData = cared;break;
case 'w': graphData = carew;break;
case 'm': graphData = carem;break;
case 'om': graphData = careom;break;
case...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.