Brief graph comparing instagram likes of the Beibs and Kim Kardashian with Dimple. Built with blockbuilder.org
Last active
November 2, 2016 19:31
-
-
Save justlebeau/6759244a0c9cd2d1450d08f9a26758c8 to your computer and use it in GitHub Desktop.
Dimple Example: Instagram Likes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<script src='//d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
<script src='//dimplejs.org/dist/dimple.v2.1.0.min.js' type='text/javascript'></script> | |
<style> | |
.rChart { | |
display: block; | |
margin-left: auto; | |
margin-right: auto; | |
width: 800px; | |
height: 400px; | |
} | |
</style> | |
</head> | |
<body > | |
<div id = 'chart1a6895d4d03' class = 'rChart dimple'></div> | |
<script type="text/javascript"> | |
var opts = { | |
"dom": "chart1a6895d4d03", | |
"width": 800, | |
"height": 400, | |
"xAxis": { | |
"type": "addCategoryAxis", | |
"showPercent": false | |
}, | |
"yAxis": { | |
"type": "addMeasureAxis", | |
"showPercent": false | |
}, | |
"zAxis": [], | |
"colorAxis": [], | |
"defaultColors": [], | |
"layers": [], | |
"legend": { | |
"x": 500, | |
"y": 50, | |
"width": 600, | |
"height": 500, | |
"horizontalAlign": "left" | |
}, | |
"x": "count", | |
"y": "likes_count", | |
"groups": "username", | |
"type": "line", | |
"id": "chart1a6895d4d03" | |
}, | |
data = [{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":10863,"filter":"Normal","created_time":1451415538,"link":"https://www.instagram.com/p/_4vrk_Avvp/","likes_count":518019,"image_url":"https://scontent.cdninstagram.com/hphotos-xft1/t51.2885-15/s640x640/sh0.08/e35/12353483_914311818654308_1486053424_n.jpg","caption":"the boyz r back in town","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150879407628549097_6860189","count":1},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":64633,"filter":"Normal","created_time":1451336714,"link":"https://www.instagram.com/p/_2ZVhKAvph/","likes_count":1984568,"image_url":"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s640x640/sh0.08/e35/12353369_1689592017921385_1725233723_n.jpg","caption":"I'll take that","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150218184712976993_6860189","count":2},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":18695,"filter":"Normal","created_time":1451336448,"link":"https://www.instagram.com/p/_2Y1D3gvon/","likes_count":1480505,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/10533599_1514218885541131_685991986_n.jpg","caption":"NA","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150215954240829991_6860189","count":3},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":9993,"filter":"Normal","created_time":1451334601,"link":"https://www.instagram.com/p/_2VTlTAvg_/","likes_count":1341616,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/12393681_1673509419599866_1262502985_n.jpg","caption":"NA","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150200459533940799_6860189","count":4},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":21144,"filter":"Normal","created_time":1451332587,"link":"https://www.instagram.com/p/_2RduFgvnW/","likes_count":1674722,"image_url":"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s640x640/sh0.08/e35/10608147_1715010985400668_1634355582_n.jpg","caption":"NA","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150183563979848150_6860189","count":5},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":23719,"filter":"Normal","created_time":1451331357,"link":"https://www.instagram.com/p/_2PHnegvhk/","likes_count":1617928,"image_url":"https://scontent.cdninstagram.com/hphotos-xft1/t51.2885-15/s640x640/sh0.08/e35/12394030_131769457196690_715947957_n.jpg","caption":"NA","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150173248961575012_6860189","count":6},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":73925,"filter":"Normal","created_time":1451328321,"link":"https://www.instagram.com/p/_2JVEJgvie/","likes_count":1848084,"image_url":"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s640x640/sh0.08/e35/12357873_484380065089093_2034491122_n.jpg","caption":"Follow me on snapchat my username is rickthesizzler","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1150147784821897374_6860189","count":7},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":36297,"filter":"Slumber","created_time":1451251940,"link":"https://www.instagram.com/p/_z3pIAgvn_/","likes_count":1926539,"image_url":"https://scontent.cdninstagram.com/hphotos-xta1/t51.2885-15/s640x640/sh0.08/e35/12338908_986351731411386_1686546732_n.jpg","caption":"\u265b Sandcastlekings @richwilkersonjr \u265b","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1149507048564783615_6860189","count":8},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":42240,"filter":"Slumber","created_time":1451144458,"link":"https://www.instagram.com/p/_wqoxlAvgC/","likes_count":1634553,"image_url":"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s640x640/sh0.08/e35/12338675_905429449572699_1305332532_n.jpg","caption":"Me and Hollywood Adam as youngins @adamhaias","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1148605424946313218_6860189","count":9},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":40643,"filter":"Moon","created_time":1451030355,"link":"https://www.instagram.com/p/_tRANcgvuO/","likes_count":1696885,"image_url":"https://scontent.cdninstagram.com/hphotos-xtp1/t51.2885-15/s640x640/sh0.08/e35/12339031_784708414989317_639191720_n.jpg","caption":"Never get to see this guy but when I do it's all laughs","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1147648261277023118_6860189","count":10},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":28804,"filter":"Normal","created_time":1450923345,"link":"https://www.instagram.com/p/_qE5cMgvuc/","likes_count":1635143,"image_url":"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s640x640/sh0.08/e35/12345756_1680732535472799_1461193691_n.jpg","caption":"NA","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1146750594590112668_6860189","count":11},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":79212,"filter":"Normal","created_time":1450923029,"link":"https://www.instagram.com/p/_qES6-AvtP/","likes_count":1854639,"image_url":"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s640x640/sh0.08/e35/12328147_1673056376244813_388608853_n.jpg","caption":"Haha","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1146747947573246799_6860189","count":12},{"type":"video","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":28051,"filter":"Normal","created_time":1450914777,"link":"https://www.instagram.com/p/_p0jjrgviD/","likes_count":1333442,"image_url":"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/e15/12331381_1277697788922522_528023013_n.jpg","caption":"NA","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1146678722053732483_6860189","count":13},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":16503,"filter":"Normal","created_time":1450908320,"link":"https://www.instagram.com/p/_poPS9Avsj/","likes_count":1518906,"image_url":"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s640x640/sh0.08/e35/12331507_443084909233740_1387177337_n.jpg","caption":"Family time","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1146624553146055459_6860189","count":14},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":50060,"filter":"Valencia","created_time":1450751752,"link":"https://www.instagram.com/p/_k9nDLAvqm/","likes_count":1878924,"image_url":"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/sh0.08/e35/12362403_976733379046535_1891611267_n.jpg","caption":"Hollywood Adam at its finest @adamhaias haha","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1145311169561688742_6860189","count":15},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":16402,"filter":"Normal","created_time":1450741041,"link":"https://www.instagram.com/p/_kpLmsgvmY/","likes_count":1492258,"image_url":"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/sh0.08/e35/12393623_1671478056458271_1405609998_n.jpg","caption":"Me uncle kev @kevo.j.nicholson","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1145221322629118360_6860189","count":16},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":43448,"filter":"Normal","created_time":1450732881,"link":"https://www.instagram.com/p/_kZnebAvmr/","likes_count":1717621,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/10012454_1515919508707794_1374770711_n.jpg","caption":"Merry Christmas","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1145152869146753451_6860189","count":17},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":26040,"filter":"Normal","created_time":1450731559,"link":"https://www.instagram.com/p/_kXGCtAvga/","likes_count":1650284,"image_url":"https://scontent.cdninstagram.com/hphotos-xat1/t51.2885-15/s640x640/sh0.08/e35/12338887_996501763749057_1882890993_n.jpg","caption":"My bro is trying to swag harder than me.","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1145141775548217370_6860189","count":18},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":35424,"filter":"Normal","created_time":1450723803,"link":"https://www.instagram.com/p/_kITUeAvix/","likes_count":1454232,"image_url":"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s640x640/sh0.08/e35/12317463_1721643928067358_650888828_n.jpg","caption":"Damn never would I have thought this","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1145076717279443121_6860189","count":19},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":48921,"filter":"Normal","created_time":1450674930,"link":"https://www.instagram.com/p/_irFV-AvtY/","likes_count":2296390,"image_url":"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s640x640/sh0.08/e35/12362545_878680405572606_1075337454_n.jpg","caption":"My little broham","username":"justinbieber","user_id":"6860189","user_fullname":"Justin Bieber","id":"1144666738491849560_6860189","count":20},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":3994,"filter":"Aden","created_time":1451411736,"link":"https://www.instagram.com/p/_4obdLOS86/","likes_count":563611,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/1515536_1719081591645111_968583080_n.jpg","caption":"FLY GIRLS","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1150847513406287674_18428658","count":1},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":6078,"filter":"Aden","created_time":1451347444,"link":"https://www.instagram.com/p/_2tzUauS3H/","likes_count":890883,"image_url":"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s640x640/sh0.08/e35/10570072_1657622874462466_164061150_n.jpg","caption":"My moms Christmas Eve party is legendary! I love creating these memories! I love my grandma MJ so much.","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1150308193549233607_18428658","count":2},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":5516,"filter":"Aden","created_time":1451336417,"link":"https://www.instagram.com/p/_2YxQ9uS7V/","likes_count":1054019,"image_url":"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s640x640/sh0.08/e35/10560958_1647969718798271_1968280557_n.jpg","caption":"Christmas Eve 2015. I put up tons of pics on my app! Xoxo","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1150215693425782485_18428658","count":3},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":18912,"filter":"Aden","created_time":1451111685,"link":"https://www.instagram.com/p/_vsINZOS4U/","likes_count":1654151,"image_url":"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s640x640/sh0.08/e35/12353471_435708359954463_1899496540_n.jpg","caption":"Merry Christmas everybody! Good night!","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1148330508186889748_18428658","count":4},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":11872,"filter":"Aden","created_time":1450986287,"link":"https://www.instagram.com/p/_r88yQOS5D/","likes_count":965448,"image_url":"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s480x480/e35/12362462_528080274033860_1276116954_n.jpg","caption":"1986 Christmas","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1147278590014467651_18428658","count":5},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":17261,"filter":"Aden","created_time":1450904998,"link":"https://www.instagram.com/p/_ph5zauS68/","likes_count":1307018,"image_url":"https://scontent.cdninstagram.com/hphotos-xtp1/t51.2885-15/s640x640/sh0.08/e35/12393949_1031809723525620_1901238063_n.jpg","caption":"CHRISTMAS CARD 2015: ALL YOU NEED IS LOVE","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1146596687896719036_18428658","count":6},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":33253,"filter":"Aden","created_time":1450826670,"link":"https://www.instagram.com/p/_nMgRfuS1o/","likes_count":738835,"image_url":"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s640x640/sh0.08/e35/12346105_457679547737138_416240537_n.jpg","caption":"KIMOJI'S","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1145939624556309864_18428658","count":7},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":32335,"filter":"Aden","created_time":1450759414,"link":"https://www.instagram.com/p/_lMOY9uS9r/","likes_count":575126,"image_url":"https://scontent.cdninstagram.com/hphotos-xft1/t51.2885-15/s640x640/sh0.08/e35/12339051_1653911508207646_1271459635_n.jpg","caption":"Ok! We're back! Everything is fixed! I'm so sorry guys! Thank you for being patient. Get KIMOJI now in the App Store!","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1145375445671817067_18428658","count":8},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":6138,"filter":"Aden","created_time":1450743995,"link":"https://www.instagram.com/p/_ku0L1OS67/","likes_count":414858,"image_url":"https://scontent.cdninstagram.com/hphotos-xtp1/t51.2885-15/s640x640/sh0.08/e35/12356462_1689498737928892_1132217783_n.jpg","caption":"#ConvoWithMom #KIMOJI I know the App Store is still working hard to fix everyone's app!","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1145246101515349691_18428658","count":9},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":12262,"filter":"Aden","created_time":1450718807,"link":"https://www.instagram.com/p/_j-xcSuS3c/","likes_count":511162,"image_url":"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s640x640/sh0.08/e35/1168781_915495425199660_660150700_n.jpg","caption":"Sister convos #KIMOJI","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1145034806799183324_18428658","count":10},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":59486,"filter":"Aden","created_time":1450676615,"link":"https://www.instagram.com/p/_iuTEXOS24/","likes_count":689962,"image_url":"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s640x640/sh0.08/e35/12356432_763571180413987_274493676_n.jpg","caption":"KIMOJI","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1144680875799686584_18428658","count":11},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":82471,"filter":"Aden","created_time":1450647305,"link":"https://www.instagram.com/p/_h2ZJtuSx4/","likes_count":647073,"image_url":"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/sh0.08/e35/12357306_1652913354977744_1963308634_n.jpg","caption":"KIMOJI'S APP LAUNCHES TOMORROW!!!","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1144435003258121336_18428658","count":12},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":10451,"filter":"Normal","created_time":1450640044,"link":"https://www.instagram.com/p/_hoi3puSxV/","likes_count":975823,"image_url":"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s640x640/sh0.08/e35/12338730_1681181245499877_1158307015_n.jpg","caption":"55 MILLION!!!!!!!OMGGGGG!!!!!! LOVE YOU SO MUCH!!!!!!!","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1144374098407271509_18428658","count":13},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":11073,"filter":"Aden","created_time":1450468075,"link":"https://www.instagram.com/p/_cgid8OSyh/","likes_count":694662,"image_url":"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s640x640/sh0.08/e35/12338770_188830368132318_233896688_n.jpg","caption":"If I knew then what I know now \ud83d\udc99 #fbf #2008","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1142931511544720545_18428658","count":14},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":6646,"filter":"Aden","created_time":1450464609,"link":"https://www.instagram.com/p/_cZ7WXuS2j/","likes_count":574319,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/12353864_152356621796267_85797946_n.jpg","caption":"Check out my app and read how Star Wars brought Kanye and I together lol","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1142902435077500323_18428658","count":15},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":19504,"filter":"Aden","created_time":1450289141,"link":"https://www.instagram.com/p/_XLQAUOS-n/","likes_count":1521504,"image_url":"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s640x640/sh0.08/e35/12357435_1563510007268451_1970911324_n.jpg","caption":"My little ballerina","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1141430508924252071_18428658","count":16},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":31248,"filter":"Normal","created_time":1450251913,"link":"https://www.instagram.com/p/_WEPh3uS_D/","likes_count":1554178,"image_url":"https://scontent.cdninstagram.com/hphotos-xta1/t51.2885-15/s640x640/sh0.08/e35/12394103_967941543275565_1698945364_n.jpg","caption":"Candy Cane Lane Kris Jenner Style","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1141118214931558339_18428658","count":17},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":7387,"filter":"Aden","created_time":1450213081,"link":"https://www.instagram.com/p/_U6LXcuSxj/","likes_count":740024,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/12354023_1633934923537601_1071175030_n.jpg","caption":"Another throwback bts of my 2007 Playboy shoot.","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1140792473421425763_18428658","count":18},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":10598,"filter":"Normal","created_time":1450210482,"link":"https://www.instagram.com/p/_U1OFhuS3c/","likes_count":668434,"image_url":"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s640x640/sh0.08/e35/10598643_934738946612479_1532489745_n.jpg","caption":"At this time back in December 2007 I shot my playboy cover with Hype Williams. For the rest of the BTS go to my app or KimKardashianWest.com","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1140770670103834076_18428658","count":19},{"type":"image","longitude":"NA","latitude":"NA","location_name":"NA","location_id":"NA","comments_count":7249,"filter":"Aden","created_time":1450205789,"link":"https://www.instagram.com/p/_UsRKnuS3v/","likes_count":839783,"image_url":"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s640x640/sh0.08/e35/12298952_1041641605900250_1924044566_n.jpg","caption":"Fave Hair \ud83d\udc87\ud83c\udffc","username":"kimkardashian","user_id":"18428658","user_fullname":"Kim Kardashian West","id":"1140731299313036783_18428658","count":20}]; | |
var svg = dimple.newSvg("#" + opts.id, opts.width, opts.height); | |
var myChart = new dimple.chart(svg, data); | |
if (opts.bounds) { | |
myChart.setBounds(opts.bounds.x, opts.bounds.y, opts.bounds.width, opts.bounds.height);//myChart.setBounds(80, 30, 480, 330); | |
} | |
//dimple allows use of custom CSS with noFormats | |
if(opts.noFormats) { myChart.noFormats = opts.noFormats; }; | |
//for markimekko and addAxis also have third parameter measure | |
//so need to evaluate if measure provided | |
//function to build axes | |
function buildAxis(position,layer){ | |
var axis; | |
var axisopts; | |
if (!layer[position+"Axis"]){ | |
axisopts = opts[position+"Axis"]; | |
} else axisopts = layer[position+"Axis"]; | |
if(axisopts.measure) { | |
axis = myChart[axisopts.type](position,layer[position],axisopts.measure); | |
} else { | |
axis = myChart[axisopts.type](position, layer[position]); | |
}; | |
if(!(axisopts.type === "addPctAxis")) axis.showPercent = axisopts.showPercent; | |
if (axisopts.orderRule) axis.addOrderRule(axisopts.orderRule); | |
if (axisopts.grouporderRule) axis.addGroupOrderRule(axisopts.grouporderRule); | |
if (axisopts.overrideMin) axis.overrideMin = axisopts.overrideMin; | |
if (axisopts.overrideMax) axis.overrideMax = axisopts.overrideMax; | |
if (axisopts.inputFormat) axis.dateParseFormat = axisopts.inputFormat; | |
if (axisopts.outputFormat) axis.tickFormat = axisopts.outputFormat; | |
return axis; | |
}; | |
var c = null; | |
if(d3.keys(opts.colorAxis).length > 0) { | |
c = myChart[opts.colorAxis.type](opts.colorAxis.colorSeries,opts.colorAxis.palette) ; | |
} | |
//allow manipulation of default colors to use with dimple | |
if(opts.defaultColors.length) { | |
opts.defaultColors = opts.defaultColors[0]; | |
if (typeof(opts.defaultColors) == "function") { | |
//assume this is a d3 scale | |
//for now loop through first 20 but need a better way to handle | |
defaultColorsArray = []; | |
for (var n=0;n<20;n++) { | |
defaultColorsArray.push(opts.defaultColors(n)); | |
}; | |
opts.defaultColors = defaultColorsArray; | |
} | |
opts.defaultColors.forEach(function(d,i) { | |
opts.defaultColors[i] = new dimple.color(d); | |
}) | |
myChart.defaultColors = opts.defaultColors; | |
} | |
//do series | |
//set up a function since same for each | |
//as of now we have x,y,groups,data,type in opts for primary layer | |
//and other layers reside in opts.layers | |
function buildSeries(layer, hidden){ | |
//inherit from primary layer if not intentionally changed or xAxis, yAxis, zAxis null | |
if (!layer.xAxis) layer.xAxis = opts.xAxis; | |
if (!layer.yAxis) layer.yAxis = opts.yAxis; | |
if (!layer.zAxis) layer.zAxis = opts.zAxis; | |
var x = buildAxis("x", layer); | |
x.hidden = hidden; | |
var y = buildAxis("y", layer); | |
y.hidden = hidden; | |
//z for bubbles | |
var z = null; | |
if (!(typeof(layer.zAxis) === 'undefined') && layer.zAxis.type){ | |
z = buildAxis("z", layer); | |
}; | |
//here think I need to evaluate group and if missing do null | |
//as the group argument | |
//if provided need to use groups from layer | |
var s = new dimple.series(myChart, null, x, y, z, c, null, dimple.plot[layer.type], dimple.aggregateMethod.avg, dimple.plot[layer.type].stacked); | |
//as of v1.1.4 dimple can use different dataset for each series | |
if(layer.data){ | |
//convert to an array of objects | |
//avoid lodash for now | |
datakeys = d3.keys(layer.data) | |
layer.dataarray = layer.data[datakeys[1]].map(function(d,i){ | |
var tempobj = {} | |
datakeys.forEach(function(key){ | |
tempobj[key] = layer.data[key][i] | |
}) | |
return tempobj | |
}) | |
s.data = layer.dataarray; | |
} | |
//for measure axis dimple sorts at the series level not at axis level | |
['x','y'].map(function(ax){ | |
if( layer[ax + 'Axis'].type=="addMeasureAxis" && layer[ax + 'Axis'].orderRule ){ | |
if( typeof layer[ax + 'Axis'].orderRule == "string" ){ | |
s.addOrderRule( layer[ax + 'Axis'].orderRule ); | |
} else if ( typeof layer[ax + 'Axis'].orderRule == "object" ) { | |
s._orderRules = layer[ax + 'Axis'].orderRule; | |
} | |
} | |
}) | |
if(layer.hasOwnProperty("groups")) { | |
s.categoryFields = (typeof layer.groups === "object") ? layer.groups : [layer.groups]; | |
//series offers an aggregate method that we will also need to check if available | |
//options available are avg, count, max, min, sum | |
} | |
if (!(typeof(layer.aggregate) === 'undefined')) { | |
s.aggregate = eval(layer.aggregate); | |
} | |
if (!(typeof(layer.lineWeight) === 'undefined')) { | |
s.lineWeight = layer.lineWeight; | |
} | |
if (!(typeof(layer.lineMarkers) === 'undefined')) { | |
s.lineMarkers = layer.lineMarkers; | |
} | |
if (!(typeof(layer.barGap) === 'undefined')) { | |
s.barGap = layer.barGap; | |
} | |
if (!(typeof(layer.interpolation) === 'undefined')) { | |
s.interpolation = layer.interpolation; | |
} | |
myChart.series.push(s); | |
/*placeholder fix domain of primary scale for new series data | |
//not working right now but something like this | |
//for now just use overrideMin and overrideMax from rCharts | |
for( var i = 0; i<2; i++) { | |
if (!myChart.axes[i].overrideMin) { | |
myChart.series[0]._axisBounds(i==0?"x":"y").min = myChart.series[0]._axisBounds(i==0?"x":"y").min < s._axisBounds(i==0?"x":"y").min ? myChart.series[0]._axisBounds(i==0?"x":"y").min : s._axisBounds(i==0?"x":"y").min; | |
} | |
if (!myChart.axes[i].overrideMax) { | |
myChart.series[0]._axisBounds(i==0?"x":"y")._max = myChart.series[0]._axisBounds(i==0?"x":"y").max > s._axisBounds(i==0?"x":"y").max ? myChart.series[0]._axisBounds(i==0?"x":"y").max : s._axisBounds(i==0?"x":"y").max; | |
} | |
myChart.axes[i]._update(); | |
} | |
*/ | |
return s; | |
}; | |
buildSeries(opts, false); | |
if (opts.layers.length > 0) { | |
opts.layers.forEach(function(layer){ | |
buildSeries(layer, true); | |
}) | |
} | |
//unsure if this is best but if legend is provided (not empty) then evaluate | |
if(d3.keys(opts.legend).length > 0) { | |
var l =myChart.addLegend(); | |
d3.keys(opts.legend).forEach(function(d){ | |
l[d] = opts.legend[d]; | |
}); | |
} | |
//quick way to get this going but need to make this cleaner | |
if(opts.storyboard) { | |
myChart.setStoryboard(opts.storyboard); | |
}; | |
myChart.draw(); | |
</script> | |
<script></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment