Skip to content

Instantly share code, notes, and snippets.

@jdavidheiser
Created March 12, 2014 23:41
Show Gist options
  • Save jdavidheiser/9519035 to your computer and use it in GitHub Desktop.
Save jdavidheiser/9519035 to your computer and use it in GitHub Desktop.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"** nvd3 visualization test **\n",
"\n",
"This uses the nvd3 packages for Python, which can be found at https://github.com/areski/python-nvd3\n",
"\n",
"This library implements Python bindings for the nvd3 javascript visualization library. ndv3 is, itself,\n",
"a layer on top of d3.js. The overall goal is to create beautiful, interactive, javascript plots\n",
"which can be viewed in a browser. Here, we will attempt to make nvd3 plots work interactively\n",
"in an ipython notebook."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***implementation note***\n",
"\n",
"First, we must note that, in IPython version 1.x, the Notebook server does not allow direct file access to the current working directory. Since most of these javascript apps are written to assume that the needed libraries are under the current directory, this will cause the imports of these javascript libraries to fail. Specificcally, nvd3 attempts to load files from ./bower_components/ - but this directory is not exposed by the IPython notebook. Instead, IPython serves them as local files at http://server:port/files/bower_components"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# import relevant libraries\n",
"\n",
"import pandas as pd\n",
"import numpy as np\n",
"import nvd3\n",
"import IPython.display as d\n",
"\n",
"def fix_html(html_doc):\n",
" html_doc = html_doc.replace(\"./bower_components/nvd3/nv.d3.min.js\",\\\n",
" \"https://raw.github.com/novus/nvd3/master/nv.d3.min.css\")\n",
" html_doc = html_doc.replace(\"./bower_components/d3/d3.min.js\",\\\n",
" \"https://rawgithub.com/mbostock/d3/v3.3.8/d3.js\")\n",
" html_doc = html_doc.replace(\"./bower_components/nvd3/src/nv.d3.css\",\\\n",
" \"https://rawgithub.com/novus/nvd3/master/nv.d3.min.css\")\n",
" return html_doc"
],
"language": "python",
"metadata": {
"code_folding": []
},
"outputs": [],
"prompt_number": 28
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"d.HTML(\n",
"'''\n",
"<!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
"<script src=\"https://rawgithub.com/mbostock/d3/v3.3.8/d3.js\" charset=\"utf-8\"></script>\n",
"<link href=\"https://rawgithub.com/novus/nvd3/master/nv.d3.min.css\" rel=\"stylesheet\" />\n",
"<script src=\"https://rawgithub.com/novus/nvd3/master/nv.d3.js\"></script>\n",
"\n",
"</head>\n",
"<body>\n",
"loading javascript\n",
"</body>\n",
"</html>\n",
"'''\n",
")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
"<!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
"<script src=\"https://rawgithub.com/mbostock/d3/v3.3.8/d3.js\" charset=\"utf-8\"></script>\n",
"<link href=\"https://rawgithub.com/novus/nvd3/master/nv.d3.min.css\" rel=\"stylesheet\" />\n",
"<script src=\"https://rawgithub.com/novus/nvd3/master/nv.d3.js\"></script>\n",
"\n",
"</head>\n",
"<body>\n",
"loading javascript\n",
"</body>\n",
"</html>\n"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 41,
"text": [
"<IPython.core.display.HTML at 0x109c3fb10>"
]
}
],
"prompt_number": 41
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# plot a stacked area chart\n",
"chart = nvd3.stackedAreaChart(name=\"Test_Stacked_Area\", height=350, x_is_date=True,\n",
" chart_options = [\"useInteractiveGuideline(true)\",\n",
" \"margin({right: 100})\",\n",
" \"rightAlignYAxis(true)\",\n",
" \"clipEdge(true)\"])\n",
"chart.set_containerheader(\"\\n\\n<h2>Stacked Area Chart</h2>\\n\\n\")\n",
"\n",
"\n",
"data = pd.read_json('stackedAreaData.json')\n",
"data = data.set_index('key')\n",
"\n",
"for index in data.index:\n",
" # convoluted array manipulations to access the data from nested lists stored in the JSON file\n",
" # amusingly, this will end up being parsed right back to the same format when it gets sent\n",
" # to the javascript\n",
" xdata = np.array(data.ix[index].values[0])[:,0]\n",
" ydata = np.array(data.ix[index].values[0])[:,1]\n",
" \n",
" chart.add_serie(name=index, y=ydata, x=xdata)\n",
"chart.buildhtml()\n",
"d.HTML( fix_html(chart.htmlcontent))"
],
"language": "python",
"metadata": {
"code_folding": []
},
"outputs": [
{
"html": [
"\n",
"<!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
"<link href=\"https://rawgithub.com/novus/nvd3/master/nv.d3.min.css\" rel=\"stylesheet\">\n",
"<script src=\"https://rawgithub.com/mbostock/d3/v3.3.8/d3.js\"></script>\n",
"<script src=\"https://raw.github.com/novus/nvd3/master/nv.d3.min.css\"></script>\n",
"\n",
"</head>\n",
"<body>\n",
"\n",
"\n",
"\n",
"<h2>Stacked Area Chart</h2>\n",
"\n",
"<div id=\"Test_Stacked_Area\"><svg style=\"height:350px;\"></svg></div>\n",
"\n",
"\n",
"<script>\n",
" nv.addGraph(function() {\n",
" var chart = nv.models.stackedAreaChart();\n",
" chart.xAxis\n",
" .tickFormat(function(d) { return d3.time.format('%d %b %Y')(new Date(parseInt(d))) }\n",
");\n",
" chart.yAxis\n",
" .tickFormat(d3.format(',.2f'));\n",
" chart.tooltipContent(function(key, y, e, graph) {\n",
" var x = d3.time.format('%d %b %Y')(new Date(parseInt(graph.point.x)));\n",
" var y = String(graph.point.y);\n",
"var y = String(graph.point.y);\n",
" tooltip_str = '<center><b>'+key+'</b></center>' + y + ' on ' + x;\n",
" return tooltip_str;\n",
" });\n",
" chart.showLegend(true);\n",
" chart.useInteractiveGuideline(true);\n",
" chart.margin({right: 100});\n",
" chart.rightAlignYAxis(true);\n",
" chart.clipEdge(true);\n",
" d3.select('#Test_Stacked_Area svg')\n",
" .datum(data_Test_Stacked_Area)\n",
" .transition().duration(500)\n",
" .attr('height', 350)\n",
" .call(chart);\n",
"\n",
" return chart;\n",
"});data_Test_Stacked_Area=[{\"values\": [{\"y\": 23.041422681023001, \"x\": 1025409600000.0}, {\"y\": 19.854291255831999, \"x\": 1028088000000.0}, {\"y\": 21.02286281168, \"x\": 1030766400000.0}, {\"y\": 22.093608385172999, \"x\": 1033358400000.0}, {\"y\": 25.108079299458002, \"x\": 1036040400000.0}, {\"y\": 26.982389242347999, \"x\": 1038632400000.0}, {\"y\": 19.828984957662001, \"x\": 1041310800000.0}, {\"y\": 19.914055036293998, \"x\": 1043989200000.0}, {\"y\": 19.436150539916, \"x\": 1046408400000.0}, {\"y\": 21.558650338602, \"x\": 1049086800000.0}, {\"y\": 24.395594061773, \"x\": 1051675200000.0}, {\"y\": 24.747089309383998, \"x\": 1054353600000.0}, {\"y\": 23.491755498806999, \"x\": 1056945600000.0}, {\"y\": 23.376634878164001, \"x\": 1059624000000.0}, {\"y\": 24.581223154532999, \"x\": 1062302400000.0}, {\"y\": 24.922476843538, \"x\": 1064894400000.0}, {\"y\": 27.357712939041999, \"x\": 1067576400000.0}, {\"y\": 26.503020572593002, \"x\": 1070168400000.0}, {\"y\": 26.658901244877999, \"x\": 1072846800000.0}, {\"y\": 27.065704156445001, \"x\": 1075525200000.0}, {\"y\": 28.735320452587999, \"x\": 1078030800000.0}, {\"y\": 31.572277846319, \"x\": 1080709200000.0}, {\"y\": 30.932161503638, \"x\": 1083297600000.0}, {\"y\": 31.627029785554001, \"x\": 1085976000000.0}, {\"y\": 28.728743674232, \"x\": 1088568000000.0}, {\"y\": 26.858365172675001, \"x\": 1091246400000.0}, {\"y\": 27.279922830032, \"x\": 1093924800000.0}, {\"y\": 34.408301211324002, \"x\": 1096516800000.0}, {\"y\": 34.794362930439, \"x\": 1099195200000.0}, {\"y\": 35.609978198950998, \"x\": 1101790800000.0}, {\"y\": 33.574394968036998, \"x\": 1104469200000.0}, {\"y\": 31.979405070597998, \"x\": 1107147600000.0}, {\"y\": 31.19009040297, \"x\": 1109566800000.0}, {\"y\": 31.083933968994, \"x\": 1112245200000.0}, {\"y\": 29.668971113185002, \"x\": 1114833600000.0}, {\"y\": 31.490638014379002, \"x\": 1117512000000.0}, {\"y\": 31.818617451127999, \"x\": 1120104000000.0}, {\"y\": 32.960314008182998, \"x\": 1122782400000.0}, {\"y\": 31.313383196208999, \"x\": 1125460800000.0}, {\"y\": 33.125486081852003, \"x\": 1128052800000.0}, {\"y\": 32.791805509149, \"x\": 1130734800000.0}, {\"y\": 33.506038030366, \"x\": 1133326800000.0}, {\"y\": 26.965016972160001, \"x\": 1136005200000.0}, {\"y\": 27.384788096809999, \"x\": 1138683600000.0}, {\"y\": 27.371377218208998, \"x\": 1141102800000.0}, {\"y\": 26.309915460827, \"x\": 1143781200000.0}, {\"y\": 26.425199957518, \"x\": 1146369600000.0}, {\"y\": 26.823411519396, \"x\": 1149048000000.0}, {\"y\": 23.850443591586998, \"x\": 1151640000000.0}, {\"y\": 23.158355444053999, \"x\": 1154318400000.0}, {\"y\": 22.998689393694999, \"x\": 1156996800000.0}, {\"y\": 27.977128511299998, \"x\": 1159588800000.0}, {\"y\": 29.073672469719, \"x\": 1162270800000.0}, {\"y\": 28.587640408904001, \"x\": 1164862800000.0}, {\"y\": 22.788453687636999, \"x\": 1167541200000.0}, {\"y\": 22.429199073597001, \"x\": 1170219600000.0}, {\"y\": 22.324103271052, \"x\": 1172638800000.0}, {\"y\": 17.558388444186999, \"x\": 1175313600000.0}, {\"y\": 16.769518096207999, \"x\": 1177905600000.0}, {\"y\": 16.214738201301, \"x\": 1180584000000.0}, {\"y\": 18.729632971229002, \"x\": 1183176000000.0}, {\"y\": 18.814523318847002, \"x\": 1185854400000.0}, {\"y\": 19.789986451358001, \"x\": 1188532800000.0}, {\"y\": 17.070049054933001, \"x\": 1191124800000.0}, {\"y\": 16.121349575716, \"x\": 1193803200000.0}, {\"y\": 15.141659430091, \"x\": 1196398800000.0}, {\"y\": 17.175388025297, \"x\": 1199077200000.0}, {\"y\": 17.286592443522, \"x\": 1201755600000.0}, {\"y\": 16.323141626567999, \"x\": 1204261200000.0}, {\"y\": 19.231263773952001, \"x\": 1206936000000.0}, {\"y\": 18.446256391095002, \"x\": 1209528000000.0}, {\"y\": 17.822632399764, \"x\": 1212206400000.0}, {\"y\": 15.53936647598, \"x\": 1214798400000.0}, {\"y\": 15.255131790217, \"x\": 1217476800000.0}, {\"y\": 15.660963922592, \"x\": 1220155200000.0}, {\"y\": 13.254482273698001, \"x\": 1222747200000.0}, {\"y\": 11.920796202299, \"x\": 1225425600000.0}, {\"y\": 12.122809090923999, \"x\": 1228021200000.0}, {\"y\": 15.691026271393, \"x\": 1230699600000.0}, {\"y\": 14.720881635107, \"x\": 1233378000000.0}, {\"y\": 15.387939360043999, \"x\": 1235797200000.0}, {\"y\": 13.765436672228001, \"x\": 1238472000000.0}, {\"y\": 14.631445864799, \"x\": 1241064000000.0}, {\"y\": 14.292446536221, \"x\": 1243742400000.0}, {\"y\": 16.170071367017002, \"x\": 1246334400000.0}, {\"y\": 15.948135554337, \"x\": 1249012800000.0}, {\"y\": 16.612872685134001, \"x\": 1251691200000.0}, {\"y\": 18.778338719091, \"x\": 1254283200000.0}, {\"y\": 16.756026065421, \"x\": 1256961600000.0}, {\"y\": 19.385804443146, \"x\": 1259557200000.0}, {\"y\": 22.950590240168001, \"x\": 1262235600000.0}, {\"y\": 23.611590181410001, \"x\": 1264914000000.0}, {\"y\": 25.708586989581001, \"x\": 1267333200000.0}, {\"y\": 26.883915999885001, \"x\": 1270008000000.0}, {\"y\": 25.893486687065, \"x\": 1272600000000.0}, {\"y\": 24.678914263176001, \"x\": 1275278400000.0}, {\"y\": 25.937275793024, \"x\": 1277870400000.0}, {\"y\": 29.461381693838, \"x\": 1280548800000.0}, {\"y\": 27.357322961861001, \"x\": 1283227200000.0}, {\"y\": 29.057235285672999, \"x\": 1285819200000.0}, {\"y\": 28.549434189385998, \"x\": 1288497600000.0}, {\"y\": 28.506352379723999, \"x\": 1291093200000.0}, {\"y\": 29.449241421598, \"x\": 1293771600000.0}, {\"y\": 25.796838168807, \"x\": 1296450000000.0}, {\"y\": 28.740145449187999, \"x\": 1298869200000.0}, {\"y\": 22.091744141871999, \"x\": 1301544000000.0}, {\"y\": 25.079662545409999, \"x\": 1304136000000.0}, {\"y\": 23.674906973064001, \"x\": 1306814400000.0}, {\"y\": 23.418002742929001, \"x\": 1309406400000.0}, {\"y\": 23.24364413887, \"x\": 1312084800000.0}, {\"y\": 31.591854066817, \"x\": 1314763200000.0}, {\"y\": 31.497112374114, \"x\": 1317355200000.0}, {\"y\": 26.67238082043, \"x\": 1320033600000.0}, {\"y\": 27.297080015494998, \"x\": 1322629200000.0}, {\"y\": 20.174315530051, \"x\": 1325307600000.0}, {\"y\": 19.631084213897999, \"x\": 1327986000000.0}, {\"y\": 20.366462219460999, \"x\": 1330491600000.0}, {\"y\": 19.284784434184999, \"x\": 1333166400000.0}, {\"y\": 19.157810257624, \"x\": 1335758400000.0}], \"key\": \"North America\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 7.9356392949024999, \"x\": 1025409600000.0}, {\"y\": 7.4514668527297996, \"x\": 1028088000000.0}, {\"y\": 7.9085410566608001, \"x\": 1030766400000.0}, {\"y\": 5.8996782364764, \"x\": 1033358400000.0}, {\"y\": 6.0591869346923, \"x\": 1036040400000.0}, {\"y\": 5.9667815800451001, \"x\": 1038632400000.0}, {\"y\": 8.6552892566399997, \"x\": 1041310800000.0}, {\"y\": 8.7690763386253998, \"x\": 1043989200000.0}, {\"y\": 8.6386160387452993, \"x\": 1046408400000.0}, {\"y\": 5.9895557449743002, \"x\": 1049086800000.0}, {\"y\": 6.3840324338159, \"x\": 1051675200000.0}, {\"y\": 6.5196511461441, \"x\": 1054353600000.0}, {\"y\": 7.0738618553114003, \"x\": 1056945600000.0}, {\"y\": 6.5745957367132997, \"x\": 1059624000000.0}, {\"y\": 6.4658359184443999, \"x\": 1062302400000.0}, {\"y\": 2.7622758754954, \"x\": 1064894400000.0}, {\"y\": 2.9794782986241, \"x\": 1067576400000.0}, {\"y\": 2.8735432712018998, \"x\": 1070168400000.0}, {\"y\": 1.6344817513645, \"x\": 1072846800000.0}, {\"y\": 1.5869248754882999, \"x\": 1075525200000.0}, {\"y\": 1.7172279157246, \"x\": 1078030800000.0}, {\"y\": 1.9649927409867001, \"x\": 1080709200000.0}, {\"y\": 2.0261695079196, \"x\": 1083297600000.0}, {\"y\": 2.0541261923929, \"x\": 1085976000000.0}, {\"y\": 3.9466318927569, \"x\": 1088568000000.0}, {\"y\": 3.7826770946088999, \"x\": 1091246400000.0}, {\"y\": 3.9543021004028001, \"x\": 1093924800000.0}, {\"y\": 3.8309891064711001, \"x\": 1096516800000.0}, {\"y\": 3.6340958946165998, \"x\": 1099195200000.0}, {\"y\": 3.5289755762524999, \"x\": 1101790800000.0}, {\"y\": 5.7023785598570003, \"x\": 1104469200000.0}, {\"y\": 5.6539569019223004, \"x\": 1107147600000.0}, {\"y\": 5.5449506370392001, \"x\": 1109566800000.0}, {\"y\": 4.7579993280677, \"x\": 1112245200000.0}, {\"y\": 4.4816139372906001, \"x\": 1114833600000.0}, {\"y\": 4.5965558568605998, \"x\": 1117512000000.0}, {\"y\": 4.3747066116975999, \"x\": 1120104000000.0}, {\"y\": 4.4588822917086999, \"x\": 1122782400000.0}, {\"y\": 4.4460351848285997, \"x\": 1125460800000.0}, {\"y\": 3.7989113035136, \"x\": 1128052800000.0}, {\"y\": 3.7743883140087999, \"x\": 1130734800000.0}, {\"y\": 3.7727852823828001, \"x\": 1133326800000.0}, {\"y\": 7.2968111448895003, \"x\": 1136005200000.0}, {\"y\": 7.2800122043237003, \"x\": 1138683600000.0}, {\"y\": 7.1187787503353999, \"x\": 1141102800000.0}, {\"y\": 8.3518870164819994, \"x\": 1143781200000.0}, {\"y\": 8.4156698763992992, \"x\": 1146369600000.0}, {\"y\": 8.1673298604231004, \"x\": 1149048000000.0}, {\"y\": 5.5132447126041999, \"x\": 1151640000000.0}, {\"y\": 6.1152537710599004, \"x\": 1154318400000.0}, {\"y\": 6.0767650919419998, \"x\": 1156996800000.0}, {\"y\": 4.6304473798646004, \"x\": 1159588800000.0}, {\"y\": 4.6301068469402002, \"x\": 1162270800000.0}, {\"y\": 4.3466656309389, \"x\": 1164862800000.0}, {\"y\": 6.8301048970030003, \"x\": 1167541200000.0}, {\"y\": 7.2416330400289999, \"x\": 1170219600000.0}, {\"y\": 7.1432372054152999, \"x\": 1172638800000.0}, {\"y\": 10.608942063374, \"x\": 1175313600000.0}, {\"y\": 10.914964549494, \"x\": 1177905600000.0}, {\"y\": 10.933223880565, \"x\": 1180584000000.0}, {\"y\": 8.3457524851264999, \"x\": 1183176000000.0}, {\"y\": 8.1078413081882008, \"x\": 1185854400000.0}, {\"y\": 8.2697185922474006, \"x\": 1188532800000.0}, {\"y\": 8.4742436475968006, \"x\": 1191124800000.0}, {\"y\": 8.4994601179318998, \"x\": 1193803200000.0}, {\"y\": 8.7387319683243003, \"x\": 1196398800000.0}, {\"y\": 6.8829183612894997, \"x\": 1199077200000.0}, {\"y\": 6.9841336378849999, \"x\": 1201755600000.0}, {\"y\": 7.0860136043287003, \"x\": 1204261200000.0}, {\"y\": 4.3961787956052998, \"x\": 1206936000000.0}, {\"y\": 3.8699674365231003, \"x\": 1209528000000.0}, {\"y\": 3.6928925238304999, \"x\": 1212206400000.0}, {\"y\": 6.7571718894253001, \"x\": 1214798400000.0}, {\"y\": 6.4367313362344003, \"x\": 1217476800000.0}, {\"y\": 6.4048441521454, \"x\": 1220155200000.0}, {\"y\": 5.4643833239669002, \"x\": 1222747200000.0}, {\"y\": 5.3150786833373997, \"x\": 1225425600000.0}, {\"y\": 5.3011272612575997, \"x\": 1228021200000.0}, {\"y\": 4.1203601430808998, \"x\": 1230699600000.0}, {\"y\": 4.0881783200525001, \"x\": 1233378000000.0}, {\"y\": 4.1928665957189004, \"x\": 1235797200000.0}, {\"y\": 7.0249415663204999, \"x\": 1238472000000.0}, {\"y\": 7.0065308807689997, \"x\": 1241064000000.0}, {\"y\": 6.9948356332239996, \"x\": 1243742400000.0}, {\"y\": 6.1220222336254002, \"x\": 1246334400000.0}, {\"y\": 6.1177436137652998, \"x\": 1249012800000.0}, {\"y\": 6.1413396231980997, \"x\": 1251691200000.0}, {\"y\": 4.8046006145874003, \"x\": 1254283200000.0}, {\"y\": 4.6647600660544004, \"x\": 1256961600000.0}, {\"y\": 4.5448650062549998, \"x\": 1259557200000.0}, {\"y\": 6.0488249316538996, \"x\": 1262235600000.0}, {\"y\": 6.3188669540206002, \"x\": 1264914000000.0}, {\"y\": 6.5873958262306003, \"x\": 1267333200000.0}, {\"y\": 6.2281189839577999, \"x\": 1270008000000.0}, {\"y\": 5.8948915746059001, \"x\": 1272600000000.0}, {\"y\": 5.5967320482213996, \"x\": 1275278400000.0}, {\"y\": 0.99784432084837005, \"x\": 1277870400000.0}, {\"y\": 1.0950794175359, \"x\": 1280548800000.0}, {\"y\": 0.94479734407491001, \"x\": 1283227200000.0}, {\"y\": 1.222093988688, \"x\": 1285819200000.0}, {\"y\": 1.3350931068559999, \"x\": 1288497600000.0}, {\"y\": 1.3302565104985, \"x\": 1291093200000.0}, {\"y\": 1.340824670897, \"x\": 1293771600000.0}, {\"y\": 0.0, \"x\": 1296450000000.0}, {\"y\": 0.0, \"x\": 1298869200000.0}, {\"y\": 0.0, \"x\": 1301544000000.0}, {\"y\": 0.0, \"x\": 1304136000000.0}, {\"y\": 0.0, \"x\": 1306814400000.0}, {\"y\": 0.0, \"x\": 1309406400000.0}, {\"y\": 0.0, \"x\": 1312084800000.0}, {\"y\": 0.0, \"x\": 1314763200000.0}, {\"y\": 4.4583692314999999, \"x\": 1317355200000.0}, {\"y\": 3.6493043348059002, \"x\": 1320033600000.0}, {\"y\": 3.8610064091760998, \"x\": 1322629200000.0}, {\"y\": 5.5144800685202, \"x\": 1325307600000.0}, {\"y\": 5.1750695220790996, \"x\": 1327986000000.0}, {\"y\": 5.6710066952691003, \"x\": 1330491600000.0}, {\"y\": 5.5611890039181002, \"x\": 1333166400000.0}, {\"y\": 5.5979368839939001, \"x\": 1335758400000.0}], \"key\": \"Africa\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 7.9149900245423002, \"x\": 1025409600000.0}, {\"y\": 7.0899888751058997, \"x\": 1028088000000.0}, {\"y\": 7.5996132380613997, \"x\": 1030766400000.0}, {\"y\": 8.2741174301034004, \"x\": 1033358400000.0}, {\"y\": 9.3564460833512992, \"x\": 1036040400000.0}, {\"y\": 9.7066786059903993, \"x\": 1038632400000.0}, {\"y\": 10.213363052343, \"x\": 1041310800000.0}, {\"y\": 10.285809585273, \"x\": 1043989200000.0}, {\"y\": 10.222053149228, \"x\": 1046408400000.0}, {\"y\": 8.6188592137974993, \"x\": 1049086800000.0}, {\"y\": 9.3335447543566001, \"x\": 1051675200000.0}, {\"y\": 8.9312402186628006, \"x\": 1054353600000.0}, {\"y\": 8.1895089343658007, \"x\": 1056945600000.0}, {\"y\": 8.2606221350790001, \"x\": 1059624000000.0}, {\"y\": 7.7700786851363999, \"x\": 1062302400000.0}, {\"y\": 7.9907428771318001, \"x\": 1064894400000.0}, {\"y\": 8.7769091865605997, \"x\": 1067576400000.0}, {\"y\": 8.4855077060660999, \"x\": 1070168400000.0}, {\"y\": 9.6277203033654999, \"x\": 1072846800000.0}, {\"y\": 9.9685913452624, \"x\": 1075525200000.0}, {\"y\": 10.615085181759, \"x\": 1078030800000.0}, {\"y\": 9.2902488079646002, \"x\": 1080709200000.0}, {\"y\": 8.8610439830061001, \"x\": 1083297600000.0}, {\"y\": 9.1075344931229001, \"x\": 1085976000000.0}, {\"y\": 9.9156737639202994, \"x\": 1088568000000.0}, {\"y\": 9.7826003238781993, \"x\": 1091246400000.0}, {\"y\": 10.554036105550001, \"x\": 1093924800000.0}, {\"y\": 10.926900264097, \"x\": 1096516800000.0}, {\"y\": 10.903144818735999, \"x\": 1099195200000.0}, {\"y\": 10.862890389066999, \"x\": 1101790800000.0}, {\"y\": 10.64604998964, \"x\": 1104469200000.0}, {\"y\": 10.042790814087001, \"x\": 1107147600000.0}, {\"y\": 9.7173391591037994, \"x\": 1109566800000.0}, {\"y\": 9.6122415755442994, \"x\": 1112245200000.0}, {\"y\": 9.4337921146561996, \"x\": 1114833600000.0}, {\"y\": 9.8148271711829995, \"x\": 1117512000000.0}, {\"y\": 12.059260396788, \"x\": 1120104000000.0}, {\"y\": 12.139649903873, \"x\": 1122782400000.0}, {\"y\": 12.281290663822, \"x\": 1125460800000.0}, {\"y\": 8.8037085409055997, \"x\": 1128052800000.0}, {\"y\": 8.6300618239176003, \"x\": 1130734800000.0}, {\"y\": 9.1225708491431998, \"x\": 1133326800000.0}, {\"y\": 12.988124170836, \"x\": 1136005200000.0}, {\"y\": 13.356778764353001, \"x\": 1138683600000.0}, {\"y\": 13.611196863270999, \"x\": 1141102800000.0}, {\"y\": 6.8959030061188997, \"x\": 1143781200000.0}, {\"y\": 6.9939633271353001, \"x\": 1146369600000.0}, {\"y\": 6.7241510257676005, \"x\": 1149048000000.0}, {\"y\": 5.5611293669517003, \"x\": 1151640000000.0}, {\"y\": 5.6086488714040996, \"x\": 1154318400000.0}, {\"y\": 5.4962849907033, \"x\": 1156996800000.0}, {\"y\": 6.9193153169277997, \"x\": 1159588800000.0}, {\"y\": 7.0016334389777999, \"x\": 1162270800000.0}, {\"y\": 6.7865422443273005, \"x\": 1164862800000.0}, {\"y\": 9.0006454225382999, \"x\": 1167541200000.0}, {\"y\": 9.2233916171431005, \"x\": 1170219600000.0}, {\"y\": 8.8929316009479003, \"x\": 1172638800000.0}, {\"y\": 10.345937520404, \"x\": 1175313600000.0}, {\"y\": 10.075914677026001, \"x\": 1177905600000.0}, {\"y\": 10.089006188111, \"x\": 1180584000000.0}, {\"y\": 10.598330295007999, \"x\": 1183176000000.0}, {\"y\": 9.9689546533008997, \"x\": 1185854400000.0}, {\"y\": 9.7740580198145999, \"x\": 1188532800000.0}, {\"y\": 10.558483060625999, \"x\": 1191124800000.0}, {\"y\": 9.9314651823603004, \"x\": 1193803200000.0}, {\"y\": 9.3997715873769003, \"x\": 1196398800000.0}, {\"y\": 8.4086493387261996, \"x\": 1199077200000.0}, {\"y\": 8.9698309085926002, \"x\": 1201755600000.0}, {\"y\": 8.2778357995396004, \"x\": 1204261200000.0}, {\"y\": 8.8585045600122996, \"x\": 1206936000000.0}, {\"y\": 8.7013756413322003, \"x\": 1209528000000.0}, {\"y\": 7.7933605469443004, \"x\": 1212206400000.0}, {\"y\": 7.0236183483063996, \"x\": 1214798400000.0}, {\"y\": 6.9873088186828998, \"x\": 1217476800000.0}, {\"y\": 6.8031713070097002, \"x\": 1220155200000.0}, {\"y\": 6.6869531315722996, \"x\": 1222747200000.0}, {\"y\": 6.1382569939630001, \"x\": 1225425600000.0}, {\"y\": 5.6434994016353999, \"x\": 1228021200000.0}, {\"y\": 5.4952202625120004, \"x\": 1230699600000.0}, {\"y\": 4.6885326869846002, \"x\": 1233378000000.0}, {\"y\": 4.4524349883437999, \"x\": 1235797200000.0}, {\"y\": 5.6766520778184999, \"x\": 1238472000000.0}, {\"y\": 5.7675774480752002, \"x\": 1241064000000.0}, {\"y\": 5.7882863168337, \"x\": 1243742400000.0}, {\"y\": 7.2666010034923998, \"x\": 1246334400000.0}, {\"y\": 7.5191821322261001, \"x\": 1249012800000.0}, {\"y\": 7.8496514514450002, \"x\": 1251691200000.0}, {\"y\": 10.383992037984999, \"x\": 1254283200000.0}, {\"y\": 9.0653691861817993, \"x\": 1256961600000.0}, {\"y\": 9.6705248324159001, \"x\": 1259557200000.0}, {\"y\": 10.856380561349001, \"x\": 1262235600000.0}, {\"y\": 11.27452370892, \"x\": 1264914000000.0}, {\"y\": 11.754156529088, \"x\": 1267333200000.0}, {\"y\": 8.2870811422454995, \"x\": 1270008000000.0}, {\"y\": 8.0210264360698993, \"x\": 1272600000000.0}, {\"y\": 7.5375074474865, \"x\": 1275278400000.0}, {\"y\": 8.3419527338039003, \"x\": 1277870400000.0}, {\"y\": 9.4197471818443006, \"x\": 1280548800000.0}, {\"y\": 8.7321733185797008, \"x\": 1283227200000.0}, {\"y\": 9.6627062648126003, \"x\": 1285819200000.0}, {\"y\": 10.187962234547999, \"x\": 1288497600000.0}, {\"y\": 9.8144201733475995, \"x\": 1291093200000.0}, {\"y\": 10.275723361712, \"x\": 1293771600000.0}, {\"y\": 16.796066079353, \"x\": 1296450000000.0}, {\"y\": 17.543254984074999, \"x\": 1298869200000.0}, {\"y\": 16.673660675082999, \"x\": 1301544000000.0}, {\"y\": 17.963944353609001, \"x\": 1304136000000.0}, {\"y\": 16.637740867209999, \"x\": 1306814400000.0}, {\"y\": 15.84857094609, \"x\": 1309406400000.0}, {\"y\": 14.767303362181, \"x\": 1312084800000.0}, {\"y\": 24.778452182433, \"x\": 1314763200000.0}, {\"y\": 18.370353229999001, \"x\": 1317355200000.0}, {\"y\": 15.253137429099, \"x\": 1320033600000.0}, {\"y\": 14.989600840649, \"x\": 1322629200000.0}, {\"y\": 16.052539160125001, \"x\": 1325307600000.0}, {\"y\": 16.424390322792998, \"x\": 1327986000000.0}, {\"y\": 17.884020741103999, \"x\": 1330491600000.0}, {\"y\": 18.372698836036001, \"x\": 1333166400000.0}, {\"y\": 18.315881576096, \"x\": 1335758400000.0}], \"key\": \"South America\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 13.153938631352, \"x\": 1025409600000.0}, {\"y\": 12.456410521864001, \"x\": 1028088000000.0}, {\"y\": 12.537048663919, \"x\": 1030766400000.0}, {\"y\": 13.947386398309, \"x\": 1033358400000.0}, {\"y\": 14.421680682568001, \"x\": 1036040400000.0}, {\"y\": 14.143238262285999, \"x\": 1038632400000.0}, {\"y\": 12.229635347478, \"x\": 1041310800000.0}, {\"y\": 12.508479916948, \"x\": 1043989200000.0}, {\"y\": 12.155368409526, \"x\": 1046408400000.0}, {\"y\": 13.335455563994, \"x\": 1049086800000.0}, {\"y\": 12.888210138167, \"x\": 1051675200000.0}, {\"y\": 12.842092790511, \"x\": 1054353600000.0}, {\"y\": 12.513816474199, \"x\": 1056945600000.0}, {\"y\": 12.21453674494, \"x\": 1059624000000.0}, {\"y\": 11.750848343935001, \"x\": 1062302400000.0}, {\"y\": 10.526579636787, \"x\": 1064894400000.0}, {\"y\": 10.873596086087, \"x\": 1067576400000.0}, {\"y\": 11.019967131519, \"x\": 1070168400000.0}, {\"y\": 11.235789380602, \"x\": 1072846800000.0}, {\"y\": 11.859910850657, \"x\": 1075525200000.0}, {\"y\": 12.531031616536, \"x\": 1078030800000.0}, {\"y\": 11.360451067019, \"x\": 1080709200000.0}, {\"y\": 11.456244780202001, \"x\": 1083297600000.0}, {\"y\": 11.436991407309, \"x\": 1085976000000.0}, {\"y\": 11.638595744327001, \"x\": 1088568000000.0}, {\"y\": 11.190418301469, \"x\": 1091246400000.0}, {\"y\": 11.835608007589, \"x\": 1093924800000.0}, {\"y\": 11.540980244475, \"x\": 1096516800000.0}, {\"y\": 10.958762325686999, \"x\": 1099195200000.0}, {\"y\": 10.885791159509001, \"x\": 1101790800000.0}, {\"y\": 13.605810720109, \"x\": 1104469200000.0}, {\"y\": 13.128978067437, \"x\": 1107147600000.0}, {\"y\": 13.119012086882, \"x\": 1109566800000.0}, {\"y\": 13.003706129783, \"x\": 1112245200000.0}, {\"y\": 13.326996807689, \"x\": 1114833600000.0}, {\"y\": 13.547947991742999, \"x\": 1117512000000.0}, {\"y\": 12.807959646616, \"x\": 1120104000000.0}, {\"y\": 12.931763821067999, \"x\": 1122782400000.0}, {\"y\": 12.795359993008001, \"x\": 1125460800000.0}, {\"y\": 9.6998935538319007, \"x\": 1128052800000.0}, {\"y\": 9.3473740089130999, \"x\": 1130734800000.0}, {\"y\": 9.36902067716, \"x\": 1133326800000.0}, {\"y\": 14.258619539874999, \"x\": 1136005200000.0}, {\"y\": 14.21241095603, \"x\": 1138683600000.0}, {\"y\": 13.973193618249001, \"x\": 1141102800000.0}, {\"y\": 15.218233920664, \"x\": 1143781200000.0}, {\"y\": 14.382109727451001, \"x\": 1146369600000.0}, {\"y\": 13.894310878491, \"x\": 1149048000000.0}, {\"y\": 15.593086090031001, \"x\": 1151640000000.0}, {\"y\": 16.244839695189, \"x\": 1154318400000.0}, {\"y\": 16.017088850646999, \"x\": 1156996800000.0}, {\"y\": 14.183951830057, \"x\": 1159588800000.0}, {\"y\": 14.148523245696, \"x\": 1162270800000.0}, {\"y\": 13.424326059970999, \"x\": 1164862800000.0}, {\"y\": 12.974450435754001, \"x\": 1167541200000.0}, {\"y\": 13.232470418021, \"x\": 1170219600000.0}, {\"y\": 13.318762655574, \"x\": 1172638800000.0}, {\"y\": 15.961407746103999, \"x\": 1175313600000.0}, {\"y\": 16.287714639804999, \"x\": 1177905600000.0}, {\"y\": 16.246590583890001, \"x\": 1180584000000.0}, {\"y\": 17.564505594808001, \"x\": 1183176000000.0}, {\"y\": 17.872725373163998, \"x\": 1185854400000.0}, {\"y\": 18.018998508755999, \"x\": 1188532800000.0}, {\"y\": 15.584518016602001, \"x\": 1191124800000.0}, {\"y\": 15.480850647182001, \"x\": 1193803200000.0}, {\"y\": 15.699120036985001, \"x\": 1196398800000.0}, {\"y\": 19.184281817226001, \"x\": 1199077200000.0}, {\"y\": 19.691226605204999, \"x\": 1201755600000.0}, {\"y\": 18.982314051292999, \"x\": 1204261200000.0}, {\"y\": 18.707820309008, \"x\": 1206936000000.0}, {\"y\": 17.459630929759001, \"x\": 1209528000000.0}, {\"y\": 16.500616076781998, \"x\": 1212206400000.0}, {\"y\": 18.086324003978, \"x\": 1214798400000.0}, {\"y\": 18.929464156259002, \"x\": 1217476800000.0}, {\"y\": 18.233728682083999, \"x\": 1220155200000.0}, {\"y\": 16.315776297325002, \"x\": 1222747200000.0}, {\"y\": 14.632892190251001, \"x\": 1225425600000.0}, {\"y\": 14.667835024479, \"x\": 1228021200000.0}, {\"y\": 13.946993947309, \"x\": 1230699600000.0}, {\"y\": 14.394304684398, \"x\": 1233378000000.0}, {\"y\": 13.724462792967, \"x\": 1235797200000.0}, {\"y\": 10.930879035806999, \"x\": 1238472000000.0}, {\"y\": 9.8339915513708007, \"x\": 1241064000000.0}, {\"y\": 10.053858541872, \"x\": 1243742400000.0}, {\"y\": 11.786998438286, \"x\": 1246334400000.0}, {\"y\": 11.780994901769001, \"x\": 1249012800000.0}, {\"y\": 11.305889670277001, \"x\": 1251691200000.0}, {\"y\": 10.918452290083, \"x\": 1254283200000.0}, {\"y\": 9.6811395055706004, \"x\": 1256961600000.0}, {\"y\": 10.971529744038, \"x\": 1259557200000.0}, {\"y\": 13.330210480209001, \"x\": 1262235600000.0}, {\"y\": 14.592637568960999, \"x\": 1264914000000.0}, {\"y\": 14.605329141157, \"x\": 1267333200000.0}, {\"y\": 13.936853794037001, \"x\": 1270008000000.0}, {\"y\": 12.189480759072, \"x\": 1272600000000.0}, {\"y\": 11.676151385045999, \"x\": 1275278400000.0}, {\"y\": 13.058852800018, \"x\": 1277870400000.0}, {\"y\": 13.62891543203, \"x\": 1280548800000.0}, {\"y\": 13.811107569918001, \"x\": 1283227200000.0}, {\"y\": 13.786494560786, \"x\": 1285819200000.0}, {\"y\": 14.045162857531, \"x\": 1288497600000.0}, {\"y\": 13.697412447286, \"x\": 1291093200000.0}, {\"y\": 13.677681376221001, \"x\": 1293771600000.0}, {\"y\": 19.961511864529999, \"x\": 1296450000000.0}, {\"y\": 21.049198298156, \"x\": 1298869200000.0}, {\"y\": 22.687631094008999, \"x\": 1301544000000.0}, {\"y\": 25.469010617433, \"x\": 1304136000000.0}, {\"y\": 24.88379943712, \"x\": 1306814400000.0}, {\"y\": 24.203843814249002, \"x\": 1309406400000.0}, {\"y\": 22.138760964035999, \"x\": 1312084800000.0}, {\"y\": 16.034636966228, \"x\": 1314763200000.0}, {\"y\": 15.394958944555, \"x\": 1317355200000.0}, {\"y\": 12.625642461969999, \"x\": 1320033600000.0}, {\"y\": 12.973735699739001, \"x\": 1322629200000.0}, {\"y\": 15.786018336150001, \"x\": 1325307600000.0}, {\"y\": 15.227368020134, \"x\": 1327986000000.0}, {\"y\": 15.899752650732999, \"x\": 1330491600000.0}, {\"y\": 15.661317319167999, \"x\": 1333166400000.0}, {\"y\": 15.359891177281, \"x\": 1335758400000.0}], \"key\": \"Asia\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 9.3433263069351007, \"x\": 1025409600000.0}, {\"y\": 8.4583069475546004, \"x\": 1028088000000.0}, {\"y\": 8.0342398154195998, \"x\": 1030766400000.0}, {\"y\": 8.1538966876572001, \"x\": 1033358400000.0}, {\"y\": 10.743604786849, \"x\": 1036040400000.0}, {\"y\": 12.349366155851, \"x\": 1038632400000.0}, {\"y\": 10.742682503898999, \"x\": 1041310800000.0}, {\"y\": 11.360983869935, \"x\": 1043989200000.0}, {\"y\": 11.441336039535001, \"x\": 1046408400000.0}, {\"y\": 10.897508791837, \"x\": 1049086800000.0}, {\"y\": 11.469101547709, \"x\": 1051675200000.0}, {\"y\": 12.086311476742001, \"x\": 1054353600000.0}, {\"y\": 8.0697180773503998, \"x\": 1056945600000.0}, {\"y\": 8.2004392233444996, \"x\": 1059624000000.0}, {\"y\": 8.4566434900642999, \"x\": 1062302400000.0}, {\"y\": 7.9565760979059004, \"x\": 1064894400000.0}, {\"y\": 9.3764619255826993, \"x\": 1067576400000.0}, {\"y\": 9.0747664160537997, \"x\": 1070168400000.0}, {\"y\": 10.508939004673, \"x\": 1072846800000.0}, {\"y\": 10.69936754483, \"x\": 1075525200000.0}, {\"y\": 10.681562399144999, \"x\": 1078030800000.0}, {\"y\": 13.184786109406, \"x\": 1080709200000.0}, {\"y\": 12.668213052351, \"x\": 1083297600000.0}, {\"y\": 13.430509403986001, \"x\": 1085976000000.0}, {\"y\": 12.393086349213, \"x\": 1088568000000.0}, {\"y\": 11.942374044841999, \"x\": 1091246400000.0}, {\"y\": 12.062227685742, \"x\": 1093924800000.0}, {\"y\": 11.969974363623001, \"x\": 1096516800000.0}, {\"y\": 12.143745740549999, \"x\": 1099195200000.0}, {\"y\": 12.69422821995, \"x\": 1101790800000.0}, {\"y\": 9.1235211044691997, \"x\": 1104469200000.0}, {\"y\": 8.7582117575840002, \"x\": 1107147600000.0}, {\"y\": 8.8072309258442996, \"x\": 1109566800000.0}, {\"y\": 11.687595946835, \"x\": 1112245200000.0}, {\"y\": 11.079723082664, \"x\": 1114833600000.0}, {\"y\": 12.049712896076, \"x\": 1117512000000.0}, {\"y\": 10.725319428683999, \"x\": 1120104000000.0}, {\"y\": 10.844849996285999, \"x\": 1122782400000.0}, {\"y\": 10.833535488460999, \"x\": 1125460800000.0}, {\"y\": 17.180932407865001, \"x\": 1128052800000.0}, {\"y\": 15.894764896516, \"x\": 1130734800000.0}, {\"y\": 16.412751299498002, \"x\": 1133326800000.0}, {\"y\": 12.573569093402, \"x\": 1136005200000.0}, {\"y\": 13.242301508051, \"x\": 1138683600000.0}, {\"y\": 12.863536342041, \"x\": 1141102800000.0}, {\"y\": 21.034044171628999, \"x\": 1143781200000.0}, {\"y\": 21.419084618802, \"x\": 1146369600000.0}, {\"y\": 21.142678863692002, \"x\": 1149048000000.0}, {\"y\": 26.56848967753, \"x\": 1151640000000.0}, {\"y\": 24.839144939905999, \"x\": 1154318400000.0}, {\"y\": 25.456187462166, \"x\": 1156996800000.0}, {\"y\": 26.350164502824999, \"x\": 1159588800000.0}, {\"y\": 26.478333205188999, \"x\": 1162270800000.0}, {\"y\": 26.425979547846001, \"x\": 1164862800000.0}, {\"y\": 28.191461582256, \"x\": 1167541200000.0}, {\"y\": 28.930307448808001, \"x\": 1170219600000.0}, {\"y\": 29.521413891117, \"x\": 1172638800000.0}, {\"y\": 28.188285966466001, \"x\": 1175313600000.0}, {\"y\": 27.704619625831, \"x\": 1177905600000.0}, {\"y\": 27.490862424829999, \"x\": 1180584000000.0}, {\"y\": 28.770679721286001, \"x\": 1183176000000.0}, {\"y\": 29.060480671450001, \"x\": 1185854400000.0}, {\"y\": 28.240998844972999, \"x\": 1188532800000.0}, {\"y\": 33.004893194128002, \"x\": 1191124800000.0}, {\"y\": 34.075180359927998, \"x\": 1193803200000.0}, {\"y\": 32.548560664834, \"x\": 1196398800000.0}, {\"y\": 30.629727432728998, \"x\": 1199077200000.0}, {\"y\": 28.642858788159, \"x\": 1201755600000.0}, {\"y\": 27.973575227843, \"x\": 1204261200000.0}, {\"y\": 27.393351882726002, \"x\": 1206936000000.0}, {\"y\": 28.476095288522, \"x\": 1209528000000.0}, {\"y\": 29.29667866426, \"x\": 1212206400000.0}, {\"y\": 29.222333802895999, \"x\": 1214798400000.0}, {\"y\": 28.092966093842001, \"x\": 1217476800000.0}, {\"y\": 28.107159262922, \"x\": 1220155200000.0}, {\"y\": 25.482974832099, \"x\": 1222747200000.0}, {\"y\": 21.208115993833999, \"x\": 1225425600000.0}, {\"y\": 20.295043095267999, \"x\": 1228021200000.0}, {\"y\": 15.925754618401999, \"x\": 1230699600000.0}, {\"y\": 17.162864628346, \"x\": 1233378000000.0}, {\"y\": 17.084345773174, \"x\": 1235797200000.0}, {\"y\": 22.24600710228, \"x\": 1238472000000.0}, {\"y\": 24.530543998508001, \"x\": 1241064000000.0}, {\"y\": 25.084184918241, \"x\": 1243742400000.0}, {\"y\": 16.606166527359001, \"x\": 1246334400000.0}, {\"y\": 17.239620011627999, \"x\": 1249012800000.0}, {\"y\": 17.336739127379001, \"x\": 1251691200000.0}, {\"y\": 25.478492475753999, \"x\": 1254283200000.0}, {\"y\": 23.017152085244, \"x\": 1256961600000.0}, {\"y\": 25.617745423683999, \"x\": 1259557200000.0}, {\"y\": 24.061133998641001, \"x\": 1262235600000.0}, {\"y\": 23.223933318646001, \"x\": 1264914000000.0}, {\"y\": 24.425887263936001, \"x\": 1267333200000.0}, {\"y\": 35.501471156693, \"x\": 1270008000000.0}, {\"y\": 33.775013878674997, \"x\": 1272600000000.0}, {\"y\": 30.417993630285, \"x\": 1275278400000.0}, {\"y\": 30.023598978467, \"x\": 1277870400000.0}, {\"y\": 33.327519522435999, \"x\": 1280548800000.0}, {\"y\": 31.963388450372001, \"x\": 1283227200000.0}, {\"y\": 30.498967232089999, \"x\": 1285819200000.0}, {\"y\": 32.403696817913001, \"x\": 1288497600000.0}, {\"y\": 31.477360719219998, \"x\": 1291093200000.0}, {\"y\": 31.53259666241, \"x\": 1293771600000.0}, {\"y\": 41.760282761547998, \"x\": 1296450000000.0}, {\"y\": 45.605771243237001, \"x\": 1298869200000.0}, {\"y\": 39.986557966215003, \"x\": 1301544000000.0}, {\"y\": 43.846330510050002, \"x\": 1304136000000.0}, {\"y\": 39.857316881857997, \"x\": 1306814400000.0}, {\"y\": 37.675127768206998, \"x\": 1309406400000.0}, {\"y\": 35.775077970312999, \"x\": 1312084800000.0}, {\"y\": 48.631009702577998, \"x\": 1314763200000.0}, {\"y\": 42.830831754504999, \"x\": 1317355200000.0}, {\"y\": 35.611502589361997, \"x\": 1320033600000.0}, {\"y\": 35.320136981738003, \"x\": 1322629200000.0}, {\"y\": 31.564136901516001, \"x\": 1325307600000.0}, {\"y\": 32.074407502432997, \"x\": 1327986000000.0}, {\"y\": 35.053013769976999, \"x\": 1330491600000.0}, {\"y\": 33.873085184128001, \"x\": 1333166400000.0}, {\"y\": 32.321039427046003, \"x\": 1335758400000.0}], \"key\": \"Europe\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 5.1162447683392003, \"x\": 1025409600000.0}, {\"y\": 4.2022848306513003, \"x\": 1028088000000.0}, {\"y\": 4.3543715758735999, \"x\": 1030766400000.0}, {\"y\": 5.4641223667245002, \"x\": 1033358400000.0}, {\"y\": 6.0041275884576999, \"x\": 1036040400000.0}, {\"y\": 6.6050520064486005, \"x\": 1038632400000.0}, {\"y\": 5.0154059912792999, \"x\": 1041310800000.0}, {\"y\": 5.1835708554647004, \"x\": 1043989200000.0}, {\"y\": 5.1142682006164, \"x\": 1046408400000.0}, {\"y\": 5.0271381717694998, \"x\": 1049086800000.0}, {\"y\": 5.3437782653456001, \"x\": 1051675200000.0}, {\"y\": 5.2105844515767004, \"x\": 1054353600000.0}, {\"y\": 6.5525659977990003, \"x\": 1056945600000.0}, {\"y\": 6.9873363581831001, \"x\": 1059624000000.0}, {\"y\": 7.0109867890970001, \"x\": 1062302400000.0}, {\"y\": 4.4254242025514996, \"x\": 1064894400000.0}, {\"y\": 4.9613848042174, \"x\": 1067576400000.0}, {\"y\": 4.8854920484764, \"x\": 1070168400000.0}, {\"y\": 4.0441111794228002, \"x\": 1072846800000.0}, {\"y\": 4.0219596813178997, \"x\": 1075525200000.0}, {\"y\": 4.3065749225354999, \"x\": 1078030800000.0}, {\"y\": 3.9148434915403998, \"x\": 1080709200000.0}, {\"y\": 3.8659430654512001, \"x\": 1083297600000.0}, {\"y\": 3.9572824600686003, \"x\": 1085976000000.0}, {\"y\": 4.7372190641521996, \"x\": 1088568000000.0}, {\"y\": 4.6871476374455003, \"x\": 1091246400000.0}, {\"y\": 5.0398702564195998, \"x\": 1093924800000.0}, {\"y\": 5.5221787544963998, \"x\": 1096516800000.0}, {\"y\": 5.4246462997979998, \"x\": 1099195200000.0}, {\"y\": 5.9240223067348996, \"x\": 1101790800000.0}, {\"y\": 5.9936860983600999, \"x\": 1104469200000.0}, {\"y\": 5.8499523215018998, \"x\": 1107147600000.0}, {\"y\": 6.4149040329325002, \"x\": 1109566800000.0}, {\"y\": 6.4547895561969, \"x\": 1112245200000.0}, {\"y\": 5.9385382611160997, \"x\": 1114833600000.0}, {\"y\": 6.0486751030591996, \"x\": 1117512000000.0}, {\"y\": 5.2310861383800002, \"x\": 1120104000000.0}, {\"y\": 5.5857797121028998, \"x\": 1122782400000.0}, {\"y\": 5.3454665096987002, \"x\": 1125460800000.0}, {\"y\": 5.0439154120119003, \"x\": 1128052800000.0}, {\"y\": 5.0546347029129999, \"x\": 1130734800000.0}, {\"y\": 5.3819451380848005, \"x\": 1133326800000.0}, {\"y\": 5.2638869269802999, \"x\": 1136005200000.0}, {\"y\": 5.5806167415681003, \"x\": 1138683600000.0}, {\"y\": 5.4539047069985003, \"x\": 1141102800000.0}, {\"y\": 7.6728842432361999, \"x\": 1143781200000.0}, {\"y\": 7.7199467166540003, \"x\": 1146369600000.0}, {\"y\": 8.0144619912941994, \"x\": 1149048000000.0}, {\"y\": 7.9422231334340001, \"x\": 1151640000000.0}, {\"y\": 8.3998279827443998, \"x\": 1154318400000.0}, {\"y\": 8.5323245726050008, \"x\": 1156996800000.0}, {\"y\": 4.7324285199762999, \"x\": 1159588800000.0}, {\"y\": 4.7402397487697003, \"x\": 1162270800000.0}, {\"y\": 4.9042069355168003, \"x\": 1164862800000.0}, {\"y\": 5.9583963430882001, \"x\": 1167541200000.0}, {\"y\": 6.3693899239171001, \"x\": 1170219600000.0}, {\"y\": 6.2611539038129997, \"x\": 1172638800000.0}, {\"y\": 5.3443942184584001, \"x\": 1175313600000.0}, {\"y\": 5.4932111235361001, \"x\": 1177905600000.0}, {\"y\": 5.5747393101108997, \"x\": 1180584000000.0}, {\"y\": 5.3833633060013, \"x\": 1183176000000.0}, {\"y\": 5.5125898831831996, \"x\": 1185854400000.0}, {\"y\": 5.8116112661327, \"x\": 1188532800000.0}, {\"y\": 4.3962296939996, \"x\": 1191124800000.0}, {\"y\": 4.6967663605521004, \"x\": 1193803200000.0}, {\"y\": 4.7963004350913998, \"x\": 1196398800000.0}, {\"y\": 4.1817985183350999, \"x\": 1199077200000.0}, {\"y\": 4.3797643870182004, \"x\": 1201755600000.0}, {\"y\": 4.6966642197965003, \"x\": 1204261200000.0}, {\"y\": 4.3609995132565, \"x\": 1206936000000.0}, {\"y\": 4.4736290996496004, \"x\": 1209528000000.0}, {\"y\": 4.3749762738128002, \"x\": 1212206400000.0}, {\"y\": 3.3274661194507003, \"x\": 1214798400000.0}, {\"y\": 3.0316184691336998, \"x\": 1217476800000.0}, {\"y\": 2.5718140204728002, \"x\": 1220155200000.0}, {\"y\": 2.7034994044602998, \"x\": 1222747200000.0}, {\"y\": 2.2033786591364, \"x\": 1225425600000.0}, {\"y\": 1.9850621240805, \"x\": 1228021200000.0}, {\"y\": 0.0, \"x\": 1230699600000.0}, {\"y\": 0.0, \"x\": 1233378000000.0}, {\"y\": 0.0, \"x\": 1235797200000.0}, {\"y\": 0.0, \"x\": 1238472000000.0}, {\"y\": 0.0, \"x\": 1241064000000.0}, {\"y\": 0.0, \"x\": 1243742400000.0}, {\"y\": 0.0, \"x\": 1246334400000.0}, {\"y\": 0.0, \"x\": 1249012800000.0}, {\"y\": 0.0, \"x\": 1251691200000.0}, {\"y\": 0.44495950017788, \"x\": 1254283200000.0}, {\"y\": 0.33945469262483002, \"x\": 1256961600000.0}, {\"y\": 0.38348269455195, \"x\": 1259557200000.0}, {\"y\": 0.0, \"x\": 1262235600000.0}, {\"y\": 0.0, \"x\": 1264914000000.0}, {\"y\": 0.0, \"x\": 1267333200000.0}, {\"y\": 0.0, \"x\": 1270008000000.0}, {\"y\": 0.0, \"x\": 1272600000000.0}, {\"y\": 0.0, \"x\": 1275278400000.0}, {\"y\": 0.0, \"x\": 1277870400000.0}, {\"y\": 0.0, \"x\": 1280548800000.0}, {\"y\": 0.0, \"x\": 1283227200000.0}, {\"y\": 0.0, \"x\": 1285819200000.0}, {\"y\": 0.0, \"x\": 1288497600000.0}, {\"y\": 0.0, \"x\": 1291093200000.0}, {\"y\": 0.0, \"x\": 1293771600000.0}, {\"y\": 0.52216435716176002, \"x\": 1296450000000.0}, {\"y\": 0.59275786698454003, \"x\": 1298869200000.0}, {\"y\": 0.0, \"x\": 1301544000000.0}, {\"y\": 0.0, \"x\": 1304136000000.0}, {\"y\": 0.0, \"x\": 1306814400000.0}, {\"y\": 0.0, \"x\": 1309406400000.0}, {\"y\": 0.0, \"x\": 1312084800000.0}, {\"y\": 0.0, \"x\": 1314763200000.0}, {\"y\": 0.0, \"x\": 1317355200000.0}, {\"y\": 0.0, \"x\": 1320033600000.0}, {\"y\": 0.0, \"x\": 1322629200000.0}, {\"y\": 0.0, \"x\": 1325307600000.0}, {\"y\": 0.0, \"x\": 1327986000000.0}, {\"y\": 0.0, \"x\": 1330491600000.0}, {\"y\": 0.0, \"x\": 1333166400000.0}, {\"y\": 0.0, \"x\": 1335758400000.0}], \"key\": \"Australia\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 1.3503144674342999, \"x\": 1025409600000.0}, {\"y\": 1.2232741112434, \"x\": 1028088000000.0}, {\"y\": 1.3930470790784, \"x\": 1030766400000.0}, {\"y\": 1.2631275030592999, \"x\": 1033358400000.0}, {\"y\": 1.5842699103708, \"x\": 1036040400000.0}, {\"y\": 1.9546996043116001, \"x\": 1038632400000.0}, {\"y\": 0.85040483009860002, \"x\": 1041310800000.0}, {\"y\": 0.85340686311352998, \"x\": 1043989200000.0}, {\"y\": 0.84306135739099997, \"x\": 1046408400000.0}, {\"y\": 2.1198469924759999, \"x\": 1049086800000.0}, {\"y\": 2.5285382124857998, \"x\": 1051675200000.0}, {\"y\": 2.5056570712835002, \"x\": 1054353600000.0}, {\"y\": 2.5212789901004999, \"x\": 1056945600000.0}, {\"y\": 2.6192011642534001, \"x\": 1059624000000.0}, {\"y\": 2.5382187823805, \"x\": 1062302400000.0}, {\"y\": 2.3393223047167999, \"x\": 1064894400000.0}, {\"y\": 2.4912198886980002, \"x\": 1067576400000.0}, {\"y\": 2.4975558749059998, \"x\": 1070168400000.0}, {\"y\": 1.7340181155459999, \"x\": 1072846800000.0}, {\"y\": 1.9307268299646001, \"x\": 1075525200000.0}, {\"y\": 2.2261679836799, \"x\": 1078030800000.0}, {\"y\": 1.7608893704206001, \"x\": 1080709200000.0}, {\"y\": 1.6242690616808, \"x\": 1083297600000.0}, {\"y\": 1.7161663801295002, \"x\": 1085976000000.0}, {\"y\": 1.7183554537038002, \"x\": 1088568000000.0}, {\"y\": 1.7179780759145, \"x\": 1091246400000.0}, {\"y\": 1.7314274801784, \"x\": 1093924800000.0}, {\"y\": 1.2596883356752, \"x\": 1096516800000.0}, {\"y\": 1.381177053009, \"x\": 1099195200000.0}, {\"y\": 1.4408819615813999, \"x\": 1101790800000.0}, {\"y\": 3.4743581836444002, \"x\": 1104469200000.0}, {\"y\": 3.3603749903192002, \"x\": 1107147600000.0}, {\"y\": 3.5350883257893, \"x\": 1109566800000.0}, {\"y\": 3.0949644237828, \"x\": 1112245200000.0}, {\"y\": 3.0796455899995001, \"x\": 1114833600000.0}, {\"y\": 3.3441247640644001, \"x\": 1117512000000.0}, {\"y\": 4.0947643978167996, \"x\": 1120104000000.0}, {\"y\": 4.4072631274051997, \"x\": 1122782400000.0}, {\"y\": 4.4870979780824998, \"x\": 1125460800000.0}, {\"y\": 4.8404549457934003, \"x\": 1128052800000.0}, {\"y\": 4.8293016233696999, \"x\": 1130734800000.0}, {\"y\": 5.2238093263951999, \"x\": 1133326800000.0}, {\"y\": 3.3823063378149998, \"x\": 1136005200000.0}, {\"y\": 3.7056975170243001, \"x\": 1138683600000.0}, {\"y\": 3.7561118692318001, \"x\": 1141102800000.0}, {\"y\": 2.8619137008540001, \"x\": 1143781200000.0}, {\"y\": 2.9933744103381001, \"x\": 1146369600000.0}, {\"y\": 2.7127537218463003, \"x\": 1149048000000.0}, {\"y\": 3.1195497076283001, \"x\": 1151640000000.0}, {\"y\": 3.4066964004507998, \"x\": 1154318400000.0}, {\"y\": 3.3754571113569001, \"x\": 1156996800000.0}, {\"y\": 2.2965579982923998, \"x\": 1159588800000.0}, {\"y\": 2.4486818633017999, \"x\": 1162270800000.0}, {\"y\": 2.4002308848517, \"x\": 1164862800000.0}, {\"y\": 1.9649579750349, \"x\": 1167541200000.0}, {\"y\": 1.9385263638056001, \"x\": 1170219600000.0}, {\"y\": 1.9128975336387, \"x\": 1172638800000.0}, {\"y\": 2.3412869836298, \"x\": 1175313600000.0}, {\"y\": 2.4337870351444999, \"x\": 1177905600000.0}, {\"y\": 2.6217970317099999, \"x\": 1180584000000.0}, {\"y\": 3.2642864957928999, \"x\": 1183176000000.0}, {\"y\": 3.3200396223709001, \"x\": 1185854400000.0}, {\"y\": 3.3934212707571998, \"x\": 1188532800000.0}, {\"y\": 4.2822327088179, \"x\": 1191124800000.0}, {\"y\": 4.1474964228540996, \"x\": 1193803200000.0}, {\"y\": 4.1477082879800999, \"x\": 1196398800000.0}, {\"y\": 5.2947122916128002, \"x\": 1199077200000.0}, {\"y\": 5.2919843508028004, \"x\": 1201755600000.0}, {\"y\": 5.1989783050309999, \"x\": 1204261200000.0}, {\"y\": 3.5603057673512999, \"x\": 1206936000000.0}, {\"y\": 3.3009087690692001, \"x\": 1209528000000.0}, {\"y\": 3.1784852603792002, \"x\": 1212206400000.0}, {\"y\": 4.5889503538868004, \"x\": 1214798400000.0}, {\"y\": 4.4017796174940003, \"x\": 1217476800000.0}, {\"y\": 4.2208301828278003, \"x\": 1220155200000.0}, {\"y\": 3.8939667147499999, \"x\": 1222747200000.0}, {\"y\": 3.0423832241354001, \"x\": 1225425600000.0}, {\"y\": 3.1355206115779999, \"x\": 1228021200000.0}, {\"y\": 1.9631418164089001, \"x\": 1230699600000.0}, {\"y\": 1.8963543874958, \"x\": 1233378000000.0}, {\"y\": 1.8266636017025, \"x\": 1235797200000.0}, {\"y\": 0.93136635895188002, \"x\": 1238472000000.0}, {\"y\": 0.92737801918887997, \"x\": 1241064000000.0}, {\"y\": 0.97591889805001997, \"x\": 1243742400000.0}, {\"y\": 2.6841193805515, \"x\": 1246334400000.0}, {\"y\": 2.5664341140531, \"x\": 1249012800000.0}, {\"y\": 2.3887523699873001, \"x\": 1251691200000.0}, {\"y\": 1.1737801663681, \"x\": 1254283200000.0}, {\"y\": 1.0953582317281001, \"x\": 1256961600000.0}, {\"y\": 1.2495674976653, \"x\": 1259557200000.0}, {\"y\": 0.36607452464753998, \"x\": 1262235600000.0}, {\"y\": 0.35487190472910002, \"x\": 1264914000000.0}, {\"y\": 0.36769242398939, \"x\": 1267333200000.0}, {\"y\": 0.0, \"x\": 1270008000000.0}, {\"y\": 0.0, \"x\": 1272600000000.0}, {\"y\": 0.0, \"x\": 1275278400000.0}, {\"y\": 0.0, \"x\": 1277870400000.0}, {\"y\": 0.0, \"x\": 1280548800000.0}, {\"y\": 0.0, \"x\": 1283227200000.0}, {\"y\": 0.85450741275336994, \"x\": 1285819200000.0}, {\"y\": 0.91360317921637002, \"x\": 1288497600000.0}, {\"y\": 0.89647678692268995, \"x\": 1291093200000.0}, {\"y\": 0.87800687192639004, \"x\": 1293771600000.0}, {\"y\": 0.0, \"x\": 1296450000000.0}, {\"y\": 0.0, \"x\": 1298869200000.0}, {\"y\": 0.43668720882994, \"x\": 1301544000000.0}, {\"y\": 0.47565236026919999, \"x\": 1304136000000.0}, {\"y\": 0.46947368328469002, \"x\": 1306814400000.0}, {\"y\": 0.45138896152315999, \"x\": 1309406400000.0}, {\"y\": 0.43828726648117, \"x\": 1312084800000.0}, {\"y\": 2.0820861395315999, \"x\": 1314763200000.0}, {\"y\": 0.93644110753950005, \"x\": 1317355200000.0}, {\"y\": 0.60583907839772999, \"x\": 1320033600000.0}, {\"y\": 0.61096950747436995, \"x\": 1322629200000.0}, {\"y\": 0.0, \"x\": 1325307600000.0}, {\"y\": 0.0, \"x\": 1327986000000.0}, {\"y\": 0.0, \"x\": 1330491600000.0}, {\"y\": 0.0, \"x\": 1333166400000.0}, {\"y\": 0.0, \"x\": 1335758400000.0}], \"key\": \"Antarctica\", \"yAxis\": \"1\"}];\n",
"</script>\n",
"\n",
"</body>\n"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 42,
"text": [
"<IPython.core.display.HTML at 0x109bfd790>"
]
}
],
"prompt_number": 42
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import random\n",
" \n",
"type = \"scatterChart\"\n",
"chart2 = nvd3.scatterChart(name=type, height=350, x_is_date=False)\n",
"chart2.set_containerheader(\"\\n\\n<h2>\" + type + \"</h2>\\n\\n\")\n",
"nb_element = 50\n",
"xdata = [i + random.randint(1, 10) for i in range(nb_element)]\n",
"ydata = [i * random.randint(1, 10) for i in range(nb_element)]\n",
"ydata2 = [x * 2 for x in ydata]\n",
"ydata3 = [x * 5 for x in ydata]\n",
" \n",
"kwargs1 = {'shape': 'circle', 'size': '1'}\n",
"kwargs2 = {'shape': 'cross', 'size': '10'}\n",
"kwargs3 = {'shape': 'triangle-up', 'size': '100'}\n",
" \n",
"extra_serie = {\"tooltip\": {\"y_start\": \"\", \"y_end\": \" calls\"}}\n",
"chart2.add_serie(name=\"serie 1\", y=ydata, x=xdata, extra=extra_serie, **kwargs1)\n",
"chart2.add_serie(name=\"serie 2\", y=ydata2, x=xdata, extra=extra_serie, **kwargs2)\n",
"chart2.add_serie(name=\"serie 3\", y=ydata3, x=xdata, extra=extra_serie, **kwargs3)\n",
" \n",
"chart2.buildhtml()\n",
"# use IPython's HTML display to view the plot inline, but replace\n",
"# the Javascript import locations due to IPython 1.x's handling of\n",
"# file serving./bower_components/nvd3\n",
"d.HTML( fix_html(chart2.htmlcontent) )\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
"<!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
"<link href=\"https://rawgithub.com/novus/nvd3/master/nv.d3.min.css\" rel=\"stylesheet\">\n",
"<script src=\"https://rawgithub.com/mbostock/d3/v3.3.8/d3.js\"></script>\n",
"<script src=\"https://raw.github.com/novus/nvd3/master/nv.d3.min.css\"></script>\n",
"\n",
"</head>\n",
"<body>\n",
"\n",
"\n",
"\n",
"<h2>scatterChart</h2>\n",
"\n",
"<div id=\"scatterChart\"><svg style=\"height:350px;\"></svg></div>\n",
"\n",
"\n",
"<script>\n",
" nv.addGraph(function() {\n",
" var chart = nv.models.scatterChart()\n",
" .showDistX(true)\n",
" .showDistY(true)\n",
" .color(d3.scale.category10().range());\n",
" chart.xAxis\n",
" .tickFormat(d3.format(',.02f'));\n",
" chart.yAxis\n",
" .tickFormat(d3.format(',.02f'));\n",
" chart.tooltipContent(function(key, y, e, graph) {\n",
" var x = String(graph.point.x);\n",
" var y = String(graph.point.y);\n",
" if(key == 'serie 1'){\n",
" var y = String(graph.point.y) + ' calls';\n",
" }\n",
" if(key == 'serie 2'){\n",
" var y = String(graph.point.y) + ' calls';\n",
" }\n",
" if(key == 'serie 3'){\n",
" var y = String(graph.point.y) + ' calls';\n",
" }\n",
" tooltip_str = '<center><b>'+key+'</b></center>' + y + ' at ' + x;\n",
" return tooltip_str;\n",
" });\n",
" chart.showLegend(true);\n",
" d3.select('#scatterChart svg')\n",
" .datum(data_scatterChart)\n",
" .transition().duration(500)\n",
" .attr('height', 350)\n",
" .call(chart);\n",
"\n",
" return chart;\n",
"});data_scatterChart=[{\"values\": [{\"y\": 0, \"x\": 1, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 7, \"x\": 8, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 6, \"x\": 12, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 18, \"x\": 5, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 36, \"x\": 13, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 35, \"x\": 12, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 24, \"x\": 15, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 56, \"x\": 9, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 8, \"x\": 18, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 90, \"x\": 17, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 50, \"x\": 16, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 33, \"x\": 13, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 120, \"x\": 17, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 130, \"x\": 23, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 70, \"x\": 24, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 45, \"x\": 20, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 16, \"x\": 21, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 68, \"x\": 22, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 108, \"x\": 19, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 114, \"x\": 28, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 180, \"x\": 27, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 210, \"x\": 27, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 198, \"x\": 25, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 23, \"x\": 33, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 216, \"x\": 32, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 250, \"x\": 33, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 234, \"x\": 32, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 243, \"x\": 29, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 224, \"x\": 38, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 145, \"x\": 34, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 210, \"x\": 37, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 155, \"x\": 39, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 320, \"x\": 35, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 264, \"x\": 41, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 68, \"x\": 36, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 315, \"x\": 38, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 324, \"x\": 41, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 111, \"x\": 39, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 304, \"x\": 39, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 39, \"x\": 48, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 120, \"x\": 47, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 246, \"x\": 47, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 210, \"x\": 44, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 172, \"x\": 46, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 352, \"x\": 48, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 315, \"x\": 51, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 368, \"x\": 53, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 235, \"x\": 57, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 384, \"x\": 50, \"shape\": \"circle\", \"size\": \"1\"}, {\"y\": 49, \"x\": 53, \"shape\": \"circle\", \"size\": \"1\"}], \"key\": \"serie 1\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 0, \"x\": 1, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 14, \"x\": 8, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 12, \"x\": 12, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 36, \"x\": 5, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 72, \"x\": 13, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 70, \"x\": 12, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 48, \"x\": 15, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 112, \"x\": 9, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 16, \"x\": 18, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 180, \"x\": 17, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 100, \"x\": 16, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 66, \"x\": 13, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 240, \"x\": 17, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 260, \"x\": 23, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 140, \"x\": 24, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 90, \"x\": 20, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 32, \"x\": 21, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 136, \"x\": 22, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 216, \"x\": 19, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 228, \"x\": 28, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 360, \"x\": 27, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 420, \"x\": 27, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 396, \"x\": 25, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 46, \"x\": 33, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 432, \"x\": 32, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 500, \"x\": 33, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 468, \"x\": 32, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 486, \"x\": 29, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 448, \"x\": 38, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 290, \"x\": 34, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 420, \"x\": 37, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 310, \"x\": 39, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 640, \"x\": 35, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 528, \"x\": 41, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 136, \"x\": 36, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 630, \"x\": 38, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 648, \"x\": 41, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 222, \"x\": 39, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 608, \"x\": 39, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 78, \"x\": 48, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 240, \"x\": 47, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 492, \"x\": 47, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 420, \"x\": 44, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 344, \"x\": 46, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 704, \"x\": 48, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 630, \"x\": 51, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 736, \"x\": 53, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 470, \"x\": 57, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 768, \"x\": 50, \"shape\": \"cross\", \"size\": \"10\"}, {\"y\": 98, \"x\": 53, \"shape\": \"cross\", \"size\": \"10\"}], \"key\": \"serie 2\", \"yAxis\": \"1\"}, {\"values\": [{\"y\": 0, \"x\": 1, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 35, \"x\": 8, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 30, \"x\": 12, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 90, \"x\": 5, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 180, \"x\": 13, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 175, \"x\": 12, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 120, \"x\": 15, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 280, \"x\": 9, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 40, \"x\": 18, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 450, \"x\": 17, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 250, \"x\": 16, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 165, \"x\": 13, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 600, \"x\": 17, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 650, \"x\": 23, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 350, \"x\": 24, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 225, \"x\": 20, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 80, \"x\": 21, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 340, \"x\": 22, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 540, \"x\": 19, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 570, \"x\": 28, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 900, \"x\": 27, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1050, \"x\": 27, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 990, \"x\": 25, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 115, \"x\": 33, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1080, \"x\": 32, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1250, \"x\": 33, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1170, \"x\": 32, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1215, \"x\": 29, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1120, \"x\": 38, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 725, \"x\": 34, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1050, \"x\": 37, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 775, \"x\": 39, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1600, \"x\": 35, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1320, \"x\": 41, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 340, \"x\": 36, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1575, \"x\": 38, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1620, \"x\": 41, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 555, \"x\": 39, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1520, \"x\": 39, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 195, \"x\": 48, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 600, \"x\": 47, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1230, \"x\": 47, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1050, \"x\": 44, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 860, \"x\": 46, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1760, \"x\": 48, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1575, \"x\": 51, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1840, \"x\": 53, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1175, \"x\": 57, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 1920, \"x\": 50, \"shape\": \"triangle-up\", \"size\": \"100\"}, {\"y\": 245, \"x\": 53, \"shape\": \"triangle-up\", \"size\": \"100\"}], \"key\": \"serie 3\", \"yAxis\": \"1\"}];\n",
"</script>\n",
"\n",
"</body>\n"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 43,
"text": [
"<IPython.core.display.HTML at 0x109c38110>"
]
}
],
"prompt_number": 43
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"type = 'pieChart'\n",
"chart1 = nvd3.pieChart(name=type, color_category='category20c', height=450, width=450)\n",
"chart1.set_containerheader(\"\\n\\n<h2>\" + type + \"</h2>\\n\\n\")\n",
"\n",
"#Create the keys\n",
"xdata = [\"Orange\", \"Banana\", \"Pear\", \"Kiwi\", \"Apple\", \"Strawberry\", \"Pineapple\"]\n",
"ydata = [3, 4, 0, 1, 5, 7, 3]\n",
"\n",
"#Add the serie\n",
"extra_serie = {\"tooltip\": {\"y_start\": \"\", \"y_end\": \" cal\"}}\n",
"chart1.add_serie(y=ydata, x=xdata, extra=extra_serie)\n",
"chart1.buildhtml()\n",
"\n",
"# use IPython's HTML display to view the plot inline, but replace\n",
"# the Javascript import locations due to IPython 1.x's handling of\n",
"# file serving.\n",
"d.HTML( fix_html(chart1.htmlcontent) )\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"\n",
"<!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
"<link href=\"https://rawgithub.com/novus/nvd3/master/nv.d3.min.css\" rel=\"stylesheet\">\n",
"<script src=\"https://rawgithub.com/mbostock/d3/v3.3.8/d3.js\"></script>\n",
"<script src=\"https://raw.github.com/novus/nvd3/master/nv.d3.min.css\"></script>\n",
"\n",
"</head>\n",
"<body>\n",
"\n",
"\n",
"\n",
"<h2>pieChart</h2>\n",
"\n",
"<div id=\"pieChart\"><svg style=\"width:450px;height:450px;\"></svg></div>\n",
"\n",
"\n",
"<script>\n",
" nv.addGraph(function() {\n",
" var chart = nv.models.pieChart();\n",
" chart.x(function(d) { return d.label })\n",
" .y(function(d) { return d.value });\n",
" chart.width(450);\n",
" chart.height(450);\n",
"\n",
" chart.tooltipContent(function(key, y, e, graph) {\n",
" var x = String(key);\n",
" var y = String(y) + ' cal';\n",
" tooltip_str = '<center><b>'+x+'</b></center>' + y;\n",
" return tooltip_str;\n",
" });\n",
" chart.showLegend(true);\n",
" chart.showLabels(true);\n",
" d3.select('#pieChart svg')\n",
" .datum(data_pieChart[0].values)\n",
" .transition().duration(500)\n",
" .attr('width', 450)\n",
".attr('height', 450)\n",
" .call(chart);\n",
"\n",
" return chart;\n",
"});data_pieChart=[{\"values\": [{\"value\": 3, \"label\": \"Orange\"}, {\"value\": 4, \"label\": \"Banana\"}, {\"value\": 0, \"label\": \"Pear\"}, {\"value\": 1, \"label\": \"Kiwi\"}, {\"value\": 5, \"label\": \"Apple\"}, {\"value\": 7, \"label\": \"Strawberry\"}, {\"value\": 3, \"label\": \"Pineapple\"}], \"key\": \"Serie 1\"}];\n",
"</script>\n",
"\n",
"</body>\n"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 44,
"text": [
"<IPython.core.display.HTML at 0x109d03fd0>"
]
}
],
"prompt_number": 44
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 44
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment