Notebook - Welcome to Notebook

Contact/Report Bugs
You can contact me at: bkenwright@xbdev.net












script src https d3js org d3 v7 min js script script src https cdn jsdelivr net npm d3 selection 3 script script src https cdn jsdelivr net npm d3 transition script script src https d3js org d3 selection multi v1 min js script style body width 960px margin 50px auto path stroke fff path hover opacity 0 9 rect hover fill blue axis font 10px sans serif legend tr border bottom 1px solid grey legend tr first child border top 1px solid grey axis path axis line fill none stroke 000 shape rendering crispEdges x axis path display none legend margin bottom 76px display inline block border collapse collapse border spacing 0px legend td padding 4px 5px vertical align bottom legendFreq legendPerc align right width 50px style body div id dashboard div script function dashboard id fData var barColor steelblue function segColor c return low 807dba mid e08214 high 41ab5d c compute total for each state fData forEach function d d total d freq low d freq mid d freq high function to handle histogram function histoGram fD var hG hGDim t 60 r 0 b 30 l 0 hGDim w 500 hGDim l hGDim r hGDim h 300 hGDim t hGDim b create svg for histogram var hGsvg d3 select id append svg attr width hGDim w hGDim l hGDim r attr height hGDim h hGDim t hGDim b append g attr transform translate hGDim l hGDim t var x d3 scaleBand domain fD map function d return d 0 range 0 hGDim w padding 0 3 Add x axis to the histogram svg var xxx d3 scaleLinear domain 0 100 This is what is written on the Axis from 0 to 100 range 100 800 This is where the axis is placed from 100px to 800px hGsvg append g attr class x axis attr transform translate 0 hGDim h call d3 axisBottom x Create function for y axis map d3 scaleLinear var y d3 scaleLinear range hGDim h 0 domain 0 d3 max fD function d return d 1 Create bars for histogram to contain rectangles and freq labels var bars hGsvg selectAll bar data fD enter append g attr class bar create the rectangles bars append rect attr x function d return x d 0 attr y function d return y d 1 attr width x rangeBand attr width x bandwidth attr height function d return hGDim h y d 1 attr fill barColor on mouseover d ii mouseover d ii mouseover is defined below on mouseout mouseout mouseout is defined below Create the frequency labels above the rectangles bars append text text function d return d3 format d 1 attr x function d return x d 0 x rangeBand 2 attr x function d return x d 0 x bandwidth 2 attr y function d return y d 1 5 attr text anchor middle function mouseover e ii utility function to be called on mouseover filter for selected state var st fData filter function s return s State ii 0 0 var nD d3 keys st freq map function s return type s freq st freq s var nD Object keys st freq map function s return type s freq st freq s call update functions of pie chart and legend pC update nD leg update nD function mouseout d utility function to be called on mouseout reset the pie chart and legend pC update tF leg update tF create function to update the bars This will be used by pie chart hG update function nD color update the domain of the y axis map to reflect change in frequencies y domain 0 d3 max nD function d return d 1 Attach the new data to the bars var bars hGsvg selectAll bar data nD transition the height and color of rectangles bars select rect transition duration 500 attr y function d return y d 1 attr height function d return hGDim h y d 1 attr fill color transition the frequency labels location and change value bars select text transition duration 500 text function d return d3 format d 1 attr y function d return y d 1 5 return hG function to handle pieChart function pieChart pD var pC pieDim w 250 h 250 pieDim r Math min pieDim w pieDim h 2 create svg for pie chart var piesvg d3 select id append svg attr width pieDim w attr height pieDim h append g attr transform translate pieDim w 2 pieDim h 2 create function to draw the arcs of the pie slices var arc d3 arc outerRadius pieDim r 10 innerRadius 0 create a function to compute the pie slice angles var pie d3 pie sort null value function d return d freq Draw the pie slices piesvg selectAll path data pie pD enter append path attr d arc each function d this _current d style fill function d return segColor d data type on mouseover d ii mouseover d ii pD on mouseout d ii mouseout d ii pD create function to update pie chart This will be used by histogram pC update function nD piesvg selectAll path data pie nD transition duration 500 attrTween d arcTween Utility function to be called on mouseover a pie slice function mouseover d ii e call the update function of histogram with new data hG update fData map function v return v State v freq ii data type segColor ii data type Utility function to be called on mouseout a pie slice function mouseout d ii e call the update function of histogram with all data hG update fData map function v return v State v total barColor Animating the pie slice requiring a custom function which specifies how the intermediate paths should be drawn function arcTween a var i d3 interpolate this _current a this _current i 0 return function t return arc i t return pC function to handle legend function legend lD var leg create table for legend var legend d3 select id append table attr class legend create one row per segment var tr legend append tbody selectAll tr data lD enter append tr create the first column for each segment tr append td append svg attr width 16 attr height 16 append rect attr width 16 attr height 16 attr fill function d return segColor d type create the second column for each segment tr append td text function d return d type create the third column for each segment tr append td attr class legendFreq text function d return d3 format d freq create the fourth column for each segment tr append td attr class legendPerc text function d return getLegend d lD Utility function to be used to update the legend leg update function nD update the data attached to the row elements var l legend select tbody selectAll tr data nD update the frequencies l select legendFreq text function d return d3 format d freq update the percentage column l select legendPerc text function d return getLegend d nD function getLegend d aD Utility function to compute percentage return d3 format d freq d3 sum aD map function v return v freq return leg calculate total frequency by segment for all state var tF low mid high map function d return type d freq d3 sum fData map function t return t freq d calculate total frequency by state for all segment var sF fData map function d return d State d total var hG histoGram sF create the histogram pC pieChart tF create the pie chart leg legend tF create the legend script script var freqData State AL freq low 4786 mid 1319 high 249 State AZ freq low 1101 mid 412 high 674 State CT freq low 932 mid 2149 high 418 State DE freq low 832 mid 1152 high 1862 State FL freq low 4481 mid 3304 high 948 State GA freq low 1619 mid 167 high 1063 State IA freq low 1819 mid 247 high 1203 State IL freq low 4498 mid 3852 high 942 State IN freq low 797 mid 1849 high 1534 State KS freq low 162 mid 379 high 471 dashboard dashboard freqData script

y d 1 5 return hG function to handle pieChart function pieChart pD var pC pieDim w 250 h 250 pieDim r Math min pieDim w pieDim h 2 create svg for pie chart var piesvg d3 select id append svg attr width pieDim w attr height pieDim h append g attr transform translate pieDim w 2 pieDim h 2 create function to draw the arcs of the pie slices var arc d3 arc outerRadius pieDim r 10 innerRadius 0 create a function to compute the pie slice angles var pie d3 pie sort null value function d return d freq Draw the pie slices piesvg selectAll path data pie pD enter append path attr d arc each function d this _current d style fill function d return segColor d data type on mouseover d ii mouseover d ii pD on mouseout d ii mouseout d ii pD create function to update pie chart This will be used by histogram pC update function nD piesvg selectAll path data pie nD transition duration 500 attrTween d arcTween Utility function to be called on mouseover a pie slice function mouseover d ii e call the update function of histogram with new data hG update fData map function v return v State v freq ii data type segColor ii data type Utility function to be called on mouseout a pie slice function mouseout d ii e call the update function of histogram with all data hG update fData map function v return v State v total barColor Animating the pie slice requiring a custom function which specifies how the intermediate paths should be drawn function arcTween a var i d3 interpolate this _current a this _current i 0 return function t return arc i t return pC function to handle legend function legend lD var leg create table for legend var legend d3 select id append table attr class legend create one row per segment var tr legend append tbody selectAll tr data lD enter append tr create the first column for each segment tr append td append svg attr width 16 attr height 16 append rect attr width 16 attr height 16 attr fill function d return segColor d type create the second column for each segment tr append td text function d return d type create the third column for each segment tr append td attr class legendFreq text function d return d3 format d freq create the fourth column for each segment tr append td attr class legendPerc text function d return getLegend d lD Utility function to be used to update the legend leg update function nD update the data attached to the row elements var l legend select tbody selectAll tr data nD update the frequencies l select legendFreq text function d return d3 format d freq update the percentage column l select legendPerc text function d return getLegend d nD function getLegend d aD Utility function to compute percentage return d3 format d freq d3 sum aD map function v return v freq return leg calculate total frequency by segment for all state var tF low mid high map function d return type d freq d3 sum fData map function t return t freq d calculate total frequency by state for all segment var sF fData map function d return d State d total var hG histoGram sF create the histogram pC pieChart tF create the pie chart leg legend tF create the legend script script var freqData State AL freq low 4786 mid 1319 high 249 State AZ freq low 1101 mid 412 high 674 State CT freq low 932 mid 2149 high 418 State DE freq low 832 mid 1152 high 1862 State FL freq low 4481 mid 3304 high 948 State GA freq low 1619 mid 167 high 1063 State IA freq low 1819 mid 247 high 1203 State IL freq low 4498 mid 3852 high 942 State IN freq low 797 mid 1849 high 1534 State KS freq low 162 mid 379 high 471 dashboard dashboard freqData script

2dracecargame
3dplot
a4print
about
acecustomkeywords
acecustomkeywords2
acejs
acejs2
acejs3
aessecurity
angularjs
animbackgroundimage
aseformat
assert
asteroidsjs
backgrounds01
backgrounds02
backgrounds03
barnsleyfern
base26
base64
bib
binary
bodypix
bouncy
box2dweb
breakoutjs
browserversion
buslanes
busybutton
bvhreader
calendar
candycrush
candycrush2
canvas
canvas2
canvas3
canvasmandelbrot
canvasmandelbrot2
canvasnumbers
canvaszoom
capsule
car2dsimulationphysics
car2dsimulationphysics2
changingimages
chaosgame
chaosrandom
chaosrandomhisto
chaosrandomhisto2
chatgptusingopenai
chatgptusingopenai2
chatgptusingopenai3
checkboxtoggle
chinesetiles
classes
classfeatures
clipboardbutton
clonenode
codedropdown
codemirror
codemirror2
collada
colorpick
columnresizer
contextmenu
convnet
cookiebanner
countdown
countdown2
countdown3
crop
css3dbarchart
css3dbarchart2
css3dbook
css3dscene
csscube
csscube2
csscube3
csscubevideos
cssfilelist
csshas
csspulse
cssresizeaspect
cssspin
csszooming
csvtoarray
curleffect
customcheckbox
customhexviewer
d3datamap
d3js
d3js10
d3js11
d3js2
d3js3
d3js4
d3js5
d3js6
d3js7
d3js8
d3js9
d3jsanimatedgrid
d3jsarctransition
d3jsarctransition2
d3jsaxis
d3jsaxischanging
d3jsbars
d3jsbrushing
d3jsbuslanes
d3jsbuslanes2
d3jscalendar
d3jscheat
d3jsclock
d3jscloudmap
d3jscogs
d3jscolors
d3jscovid
d3jscovid2
d3jscovid3
d3jsdashboard
d3jsdashboard2
d3jsdashboard3
d3jsdatakeyfunction
d3jsdensity
d3jsdragresizing
d3jsdragresizing2
d3jseach
d3jsease
d3jsevents
d3jsflower
d3jsforcegroups
d3jsforces
d3jsforces2
d3jsfractaltree
d3jsgeo
d3jsgroupbars
d3jsgroups
d3jsheatmap
d3jshex
d3jshierarchies
d3jshierarchies2
d3jshistogram
d3jshistogram2
d3jshistogram3
d3jshistogram4
d3jsinterpolate
d3jsjoin
d3jskmean
d3jskmean2
d3jsline
d3jsline2
d3jsline3
d3jsline4
d3jslinetransition
d3jslinetransition0
d3jslinetransition2
d3jsmaplocations
d3jsmaps
d3jsmaps2
d3jsmaps3
d3jsmisc
d3jsmisc2
d3jsmodule
d3jsmodulecolor
d3jsmultistyles
d3jsnobel
d3jsoverlappinggraphs
d3jspanel
d3jspie
d3jspieinterpolate
d3jssankey
d3jssankey2
d3jsscatter
d3jsshapes
d3jsslider
d3jsspending
d3jsspending2
d3jsspiralplot
d3jsspirograph
d3jssquare
d3jsstack
d3jsstackedbar
d3jsstackedbar2
d3jssunburst
d3jssunmoon
d3jssvglines
d3jssymbols
d3jstimelines
d3jsuk
d3jsvoronoi
d3scatterplot
d3timeline
d3timeline2
datalist
datamuse
date
dblclickhighlight
deviceorientation
dictionaryapi
dockermenu
doodlepad
downloadgif
dragdroplistitems
dragrotateresizediv
dragrotateresizediv2
dragrotateresizediv3
dragrotateresizediv4
dragrotateresizefontsize
dragselectbrush
drawlinesdiv
dropdown
dualquaternionimages
dynamicgrid
easefunctions
easeinterpolate3dplots
echart
echart2
echart3
encapsulation
epubviewer
errorstack
excalidraw
excalidraw2
excalidraw3
excalidraw5
expandable
faker
fetchplus
fileupload
fixedtopbar
fluiddynamics
fluiddynamics2
fluiddynamics3
fluidgaswatergl
fluidsmokedynamics
fluidsmokedynamics2
fonts
fonts2
footerbar
fractalcircles
fractalmaze
fractalmaze2
fractalnoiseimage
fractals
fractals2
fractaltree
freesvg
fresnel
froggerjs
gantt
gifgiphyapi
gifhex
gltffromscratch
gradients
griditems
griditems2
griditems3
griditems4
gridworms
happyfont
heat
hexview
hexview2
highlight
icons
icons2
iframes
ik
imagetracertosvg
imgur
inputfile
invadersjs
ipynb
ipynb2
ipynb3
ipynb4
isbn13
isbn2
jpghex
jquery
jquery2
jqueryui
jqueryui2
jsdraganddrop
jsfire
jslint
jsobfuscate
jsraytracer
jstree
jstree2
jszip
jszipimages
jszipread
keyboardpiano
keyframes
l2dwidget
lcpsolverrigidbodies
lda
leftmenu
less
less2
lineargradientimage
linenumbers
loadimagefromfile
makepdf
maps
markdown
markdown2
markdown3
markdownalerts
markdownalerts2
markdownbookmarks
markovimage
markovpixelblocks
mathjax
matrices
matsandvects
mazegamejs
md2tex
metrotiles
metrowindows
milestones
minkowski2dboxes
misc
misc2
modules
myipdetails
mymodplotly
neataptic
networkstructures
networkstructures2
neural_network_drawshape
neural_network_plot_in_vs_out
neuralnetworkarrays
neuralnetworkblocks
neuralnetworksinewave
neuralnetworksnolibs
neuralnetworkvisualization
noiseflowfield
noiseflowfield2
noiseflowfield3
noiseflowfield4
noiseflowfield5
noiseflowfield6
number
obj
objtojson
openaiimages
opencv
opencv2
opencv3
opencv4
opencv5
outline
p2
p5fractalleaf
p5fractalshape
p5js
p5js2
p5js3
p5jsanimatedcover
p5mengercube
p5snowflakes
palindrome
panel
parallax
paste
paste2
pasteimgfromurl
pdfjs
pdfjs2
pdfkit
pdfkit2
pdfkit3
pdfkit4
pdfkit5
pdfkit6
pdfmake
pdfmake2
pdfmake3
pdfmake4
pdfmake5
pdfmake6
perlin
perlin2
perlin3
perspective
pexels
pixelgridpattern
playground
plotly
plotlynoise
plotlyranddist
plyloader
plyloader2
pngtxtencoder
pongjs
pptxgenjs
prettycode
prism
prn
problems
progress
pseudorandom
px2svg
python
quotes
racergame
random
randomcalcpie
randomgenerator
randomprofilepatterns
randomsinhistogram
randomstring
rating
rayambient
raymonte
raymonteprogressive
raymonteprogressive2
raymontewarmstart
reexpcross
reexpcross2
regex
regexbib
regexpfixbib
regexpmultiline
repeatwordsregexp
resizabletable
resizabletable2
revealjs
revealjs2
revealjsmulti
rigidbodyspheres2d
rigidbodyspheres3
rigidbodysphereslopetangent
ritalanguage
ritalanguage2
ritalanguage3
rotateimg
rough
rsapublicprivatekeys
rss
rss2
sankey
scrappingsvg
scrolltext
scrolltext2
scrollwidth
sdf2dcanvas
sdfboxinboxtwist
sdfchessbishop
sdfchessking
sdfchessknight
sdfchesspawn
sdfchessqueen
sdfchessrook
sdfhollowbox
setintervalexception
shareurl
shuffle
sidecomment
similarity
simplehighlighter
simpleplatformgamejs
sinecanvas
sliderpopout
slides
smileys
snowfall
snowman
sound
soundsignal
sphererayintersection
springs
sqljs
steganography
stereogram
stringmatching
sudoku
sudoku2
sudoku3
svg
svgchaos
svgdragresize
svgdragresize2
svgdragresize3
svgdragrotate
svgdrawing
svglines
svglines2
svglines3
svglines4
svglines5
svglinesmandelbrot
svgpathsdragrotate
svgpathsdragrotateresize
svgpie
svgpie2
svgpie3
svgpiepath
svgpiepath2
svgrandomfaces
symbolcanvas
symbols
synaptic
synaptic2
synonyms
tablerotatecells
tablerotatecells2
tablerotatecells3
tablerotatecells3b
tablerotatecells4
tables
tablezebra
tabularjs
tabularjs2
tabulatordownload
tagcanvas
tensorflowdenoiseencoder
tensorflowgan
tensorflowjs
tensorflowjsbasic
tensorflowjscnn
tensorflowjssinewave
tensorflowjssound
tensorflowmobilenet
tetrahedronfractal
tetrahedronfractalfolding
tetris
textarea
textareaauto
textareadiv
textareadiv2
textmaskimage
theirorthere
thesaurus
threejs
threejs2
threejs3
threejs4
threejsgltf
threejstokyo
tiles
toaster
tooltip
transition
transitionexpandabledropdown
treeview
treeview2
tricks
tshirt
tshirt2
tshirt3
turningpages
unsplash
urlblob
urlblob2
userdefinepoints
vector
videos
videos2
visualsort
vue
w2ui
w2uientertextdialog
webcam
webgl
webgl2
webgl3
webgl4
webgl5
webglbasic1
webglbasic2
webglcube
webglfov
webglfrustum
webgljson
webglleaves
webgllighting
webglorthographic
webglpoints1
webglpoints2
webglpoints3
webglsquare
webgltexture1
webgltexture2
webgltexture3
webgltransforms
webgltriangle
webgpu
webgpu10
webgpu11
webgpu12
webgpu13
webgpu14
webgpu15
webgpu16
webgpu17
webgpu2
webgpu3
webgpu4
webgpu5
webgpu6
webgpu7
webgpu8
webgpu9
webgpubars
webgpubuffers
webgpubuffers2
webgpucellnoise
webgpuclouds
webgpuclydescope
webgpucompute
webgpucubemap
webgpucubemap2
webgpudeferred
webgpudepth
webgpudof
webgpudrops
webgpuetha
webgpufire
webgpufractalcubes
webgpuglassrain
webgpugltf
webgpugltf2
webgpugrass
webgpugrid
webgpukernel
webgpukleinian
webgpulabupdates
webgpulighting
webgpumandelbrot
webgpumeta3d
webgpumetaballs
webgpumouse
webgpunoise
webgpunormalmapping
webgpuobj
webgpuparallax
webgpuparallax2
webgpuparallax3
webgpuparallaxshadow
webgpuparallaxshadow2
webgpupixel
webgpuquad
webgpuray1
webgpuraytracing
webgpuraytracing2
webgpushadowmaps
webgpushadowmaps2
webgpusierpinski2d
webgpusierpinski3d
webgpusinusoid
webgpussao
webgpustadiumobj
webgpuswirl
webgputestpipe3
webgputoon
webgputopology
webgputt
webgpuvolcloud
webgpuwater
webgpuwireframe
webgpuwireframe2
webnn
webnn2
webnnconv2d
webnnlstm
webnnpytorch
webnntraining
webnnwithsynaptic
webnnwithsynaptic2
webnnwithsynapticsinwave
webnnwithtensorflow
webpcanvas
webworkers
webxr
webxr2
wiggly
wikipedia