Skip to content

Instantly share code, notes, and snippets.

@mndrake
Created February 1, 2015 00:11
Show Gist options
  • Save mndrake/1c5dc0255e93172749af to your computer and use it in GitHub Desktop.
Save mndrake/1c5dc0255e93172749af to your computer and use it in GitHub Desktop.
attempt to use nvd3 in ifsharp
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"language": "fsharp",
"name": "",
"signature": "sha256:acb6dd2342bbfec88b931a27d5060d0bee7e8880294868f645faab5f135d5f14"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"\"\"\"<svg style='height:400px;width:600px'/>\n",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css\">\n",
"<script type=\"text/javascript\" src=\"//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js\"></script>\n",
"<script type=\"text/javascript\" src=\"//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js\"></script>\n",
"\n",
"<script type=\"text/javascript\">\n",
" function myData() {\n",
" var series1 = [];\n",
" for(var i =1; i < 100; i ++) {\n",
" series1.push({\n",
" x: i, y: 100 / i\n",
" });\n",
" }\n",
"\n",
" return [\n",
" {\n",
" key: \"Series #1\",\n",
" values: series1,\n",
" color: \"#0000ff\"\n",
" }\n",
" ];\n",
" }\n",
"\n",
" nv.addGraph(function() {\n",
" var chart = nv.models.lineChart();\n",
"\n",
" chart.xAxis\n",
" .axisLabel(\"X-axis Label\");\n",
"\n",
" chart.yAxis\n",
" .axisLabel(\"Y-axis Label\")\n",
" .tickFormat(d3.format(\"d\"))\n",
" ;\n",
"\n",
" d3.select(\"svg\")\n",
" .datum(myData())\n",
" .transition().duration(500).call(chart);\n",
"\n",
" nv.utils.windowResize(\n",
" function() {\n",
" chart.update();\n",
" }\n",
" );\n",
"\n",
" return chart;\n",
" });\n",
"</script>\"\"\"\n",
"\n",
"|> Util.Html"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<svg style='height:400px;width:600px'/>\n",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css\">\n",
"<script type=\"text/javascript\" src=\"//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js\"></script>\n",
"<script type=\"text/javascript\" src=\"//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js\"></script>\n",
"\n",
"<script type=\"text/javascript\">\n",
" function myData() {\n",
" var series1 = [];\n",
" for(var i =1; i < 100; i ++) {\n",
" series1.push({\n",
" x: i, y: 100 / i\n",
" });\n",
" }\n",
"\n",
" return [\n",
" {\n",
" key: \"Series #1\",\n",
" values: series1,\n",
" color: \"#0000ff\"\n",
" }\n",
" ];\n",
" }\n",
"\n",
" nv.addGraph(function() {\n",
" var chart = nv.models.lineChart();\n",
"\n",
" chart.xAxis\n",
" .axisLabel(\"X-axis Label\");\n",
"\n",
" chart.yAxis\n",
" .axisLabel(\"Y-axis Label\")\n",
" .tickFormat(d3.format(\"d\"))\n",
" ;\n",
"\n",
" d3.select(\"svg\")\n",
" .datum(myData())\n",
" .transition().duration(500).call(chart);\n",
"\n",
" nv.utils.windowResize(\n",
" function() {\n",
" chart.update();\n",
" }\n",
" );\n",
"\n",
" return chart;\n",
" });\n",
"</script>"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 2
}
],
"prompt_number": 2
},
{
"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