Skip to content

Instantly share code, notes, and snippets.

@patilv
Created May 19, 2014 07:13
Show Gist options
  • Save patilv/96e7ff794d15384abfbc to your computer and use it in GitHub Desktop.
Save patilv/96e7ff794d15384abfbc to your computer and use it in GitHub Desktop.
TCrimeplot1
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/assets/css/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/assets/lib/fisheye.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 750px;
height: 600px;
}
</style>
</head>
<body >
<div id = 'chart1dac5fd13fe9' class = 'rChart nvd3'></div>
<script type='text/javascript'>
$(document).ready(function(){
drawchart1dac5fd13fe9()
});
function drawchart1dac5fd13fe9(){
var opts = {
"dom": "chart1dac5fd13fe9",
"width": 750,
"height": 600,
"x": "Year",
"y": "value",
"group": "variable",
"type": "stackedAreaChart",
"id": "chart1dac5fd13fe9"
},
data = [
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 16075,
"percval": "11.18 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 16373,
"percval": "11.45 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 15847,
"percval": "11.27 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 18233,
"percval": "11.81 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 18359,
"percval": "11.8 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 19348,
"percval": "11.74 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 20737,
"percval": "11.19 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 21467,
"percval": "10.96 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 21397,
"percval": "10.5 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 22172,
"percval": "10.38 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 24206,
"percval": "10.59 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "Rape",
"value": 24923,
"percval": "10.2 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 14645,
"percval": "10.18 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 14506,
"percval": "10.14 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 13296,
"percval": "9.46 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 15578,
"percval": "10.09 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 15750,
"percval": "10.13 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 17414,
"percval": "10.57 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 20416,
"percval": "11.02 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 22939,
"percval": "11.71 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 25741,
"percval": "12.63 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 29795,
"percval": "13.95 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 35565,
"percval": "15.55 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "KidnappingAndAbduction",
"value": 38262,
"percval": "15.66 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 6851,
"percval": "4.76 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 6822,
"percval": "4.77 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 6208,
"percval": "4.42 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 7026,
"percval": "4.55 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 6787,
"percval": "4.36 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 7618,
"percval": "4.62 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 8093,
"percval": "4.37 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 8172,
"percval": "4.17 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 8383,
"percval": "4.11 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 8391,
"percval": "3.93 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 8618,
"percval": "3.77 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "DowryDeaths",
"value": 8233,
"percval": "3.37 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 34124,
"percval": "23.73 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 33943,
"percval": "23.73 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 32939,
"percval": "23.43 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 34567,
"percval": "22.4 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 34175,
"percval": "21.97 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 36617,
"percval": "22.22 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 38734,
"percval": "20.9 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 40413,
"percval": "20.63 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 38711,
"percval": "18.99 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 40613,
"percval": "19.01 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 42968,
"percval": "18.79 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "AssaultWithIntentToOutrageModesty",
"value": 45351,
"percval": "18.57 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 9746,
"percval": "6.78 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 10155,
"percval": "7.1 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 12325,
"percval": "8.77 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 10001,
"percval": "6.48 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 9984,
"percval": "6.42 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 9966,
"percval": "6.05 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 10950,
"percval": "5.91 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 12214,
"percval": "6.24 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 11009,
"percval": "5.4 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 9961,
"percval": "4.66 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 8570,
"percval": "3.75 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "InsultToModesty",
"value": 9173,
"percval": "3.76 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 49170,
"percval": "34.19 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 49237,
"percval": "34.42 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 50703,
"percval": "36.06 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 58121,
"percval": "37.66 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 58319,
"percval": "37.49 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 63128,
"percval": "38.31 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 75930,
"percval": "40.97 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 81344,
"percval": "41.53 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 89546,
"percval": "43.94 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 94041,
"percval": "44.03 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 99135,
"percval": "43.36 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "CrueltyByHusbandOrHisRelatives",
"value": 106527,
"percval": "43.61 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 114,
"percval": "0.08 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 76,
"percval": "0.05 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 46,
"percval": "0.03 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 89,
"percval": "0.06 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 149,
"percval": "0.1 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 67,
"percval": "0.04 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 61,
"percval": "0.03 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 67,
"percval": "0.03 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 48,
"percval": "0.02 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 36,
"percval": "0.02 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 80,
"percval": "0.03 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "ImportationOfGirlsFromForeignCountry",
"value": 59,
"percval": "0.02 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 8796,
"percval": "6.12 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 6598,
"percval": "4.61 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 5510,
"percval": "3.92 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 5748,
"percval": "3.72 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 5908,
"percval": "3.8 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 4541,
"percval": "2.76 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 3568,
"percval": "1.93 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 2660,
"percval": "1.36 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 2474,
"percval": "1.21 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 2499,
"percval": "1.17 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 2435,
"percval": "1.06 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "ImmoralTrafficPAct",
"value": 2563,
"percval": "1.05 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 3222,
"percval": "2.24 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 2816,
"percval": "1.97 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 2684,
"percval": "1.91 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 3592,
"percval": "2.33 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 3204,
"percval": "2.06 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 4504,
"percval": "2.73 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 5623,
"percval": "3.03 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 5555,
"percval": "2.84 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 5650,
"percval": "2.77 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 5182,
"percval": "2.43 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 6619,
"percval": "2.89 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "DowryProhibitionAct",
"value": 9038,
"percval": "3.7 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 1052,
"percval": "0.73 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 2508,
"percval": "1.75 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 1043,
"percval": "0.74 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 1378,
"percval": "0.89 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 2917,
"percval": "1.88 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 1562,
"percval": "0.95 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 1200,
"percval": "0.65 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 1025,
"percval": "0.52 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 845,
"percval": "0.41 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 895,
"percval": "0.42 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 453,
"percval": "0.2 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "IndecentRepresentationOfWomenPAct",
"value": 141,
"percval": "0.06 % of Total Crimes for the year"
},
{
"Year": 2001,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2002,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2003,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2004,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2005,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 1,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2006,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2007,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2008,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 1,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2009,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2010,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2011,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 1,
"percval": "0 % of Total Crimes for the year"
},
{
"Year": 2012,
"StateUT": "TOTAL",
"variable": "CommissionOfSatiPreventionAct",
"value": 0,
"percval": "0 % of Total Crimes for the year"
}
]
if(!(opts.type==="pieChart" || opts.type==="sparklinePlus" || opts.type==="bulletChart")) {
var data = d3.nest()
.key(function(d){
//return opts.group === undefined ? 'main' : d[opts.group]
//instead of main would think a better default is opts.x
return opts.group === undefined ? opts.y : d[opts.group];
})
.entries(data);
}
if (opts.disabled != undefined){
data.map(function(d, i){
d.disabled = opts.disabled[i]
})
}
nv.addGraph(function() {
var chart = nv.models[opts.type]()
.width(opts.width)
.height(opts.height)
if (opts.type != "bulletChart"){
chart
.x(function(d) { return d[opts.x] })
.y(function(d) { return d[opts.y] })
}
chart
.tooltip( function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
'<p>' + y + ' on ' + x + '</p>' +
'<p>' + e.point.percval + '</p>'
})
d3.select("#" + opts.id)
.append('svg')
.datum(data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
};
</script>
<script></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment