From 30074c01f4aa665754d46354712593b6d3b395b4 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sat, 28 Nov 2015 17:45:28 +0500 Subject: [PATCH] added chart --- chart/README.md | 18 +++ chart/preview/host-lookup-chart.png | Bin 0 -> 12945 bytes chart/src/data.tsv | 9 ++ chart/src/index.html | 181 ++++++++++++++++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 chart/README.md create mode 100755 chart/preview/host-lookup-chart.png create mode 100644 chart/src/data.tsv create mode 100644 chart/src/index.html diff --git a/chart/README.md b/chart/README.md new file mode 100644 index 0000000..b2c8720 --- /dev/null +++ b/chart/README.md @@ -0,0 +1,18 @@ +Dual-scale-D3-Bar-Chart +======================== + +This is a demo for creating dual-scaled bar charts using D3.js + +I came across this task when I was working on a simple HTML project. As I googled around and, unfortunately, could not find any example, I decided to do it myself. + +Please bear in mind that I am new to D3.js and this is actually my first time using it. I had heard of D3.js but never used it. + +Hope that this could be of use to someone. All suggestions for improvement are welcome. + +Note: since d3.js uses ajax to load tsv files, the files contained in the src folder cannot be run in a browser using file:///. Execute the following command under the src directory to create a HTTP server. + + python -m SimpleHTTPServer + +Use the following URL to access index.html + + http://localhost:8000/index.html diff --git a/chart/preview/host-lookup-chart.png b/chart/preview/host-lookup-chart.png new file mode 100755 index 0000000000000000000000000000000000000000..832b3635db9bf70f7e7e49091218787b4fcb60e7 GIT binary patch literal 12945 zcmeHt3pA8#-?zQn)$SlqPhszD>}U5%CG1jE8k1Do3Q1Blri4it2{SQfRCXzLri4io zQ#w0l#4v;DB&WtiPB#Xb7|bb#8DmcGJwt6Bp6^@hd)NBbdcW_@YFTFP`?|0H|N8xZ z|KIhy?n`@J9JS{!o3Ev%rTxdQ?fbN}W&v7S-x>cn2mHk2#_SW|ukXV5Id0R+Z}?>h z{No3Ny|cZRRv~_Y{OD}(?|CP89SYadTJ%!=|GQMPMFv`0>sI`+-G2XRA3m!w=rAI4 zAdCq=8gQrsLr8>K(`Lm9JHmBg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