Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLJS] Replacement for byte-array in commits->matrix for GitHub heatmap? #63

Open
f6m6 opened this issue Aug 27, 2017 · 0 comments
Open

Comments

@f6m6
Copy link

f6m6 commented Aug 27, 2017

Hi there - thanks for the amazing tools. 馃槃 I've got a bar graph working in my reagent project and am now looking at adding the GitHub-commit style visualisation.

  1. When it comes to the commits->matrix function I'm stuck as byte-array doesn't exist in ClojureScript. I tried binding mat to ((nd/ndarray :int32 (repeat (* 7 weeks) 0) [7 weeks]) but it didn't make any difference - I get a weird error down the line:
[Error] TypeError: f.call is not a function. (In 'f.call(null,x)', 'f.call' is undefined)
	(anonymous function) (core.js:125)
	(anonymous function) (core.js:980)
	(anonymous function) (core.js:18375:140)
	(anonymous function) (core.js:7888:101)
	cljs$core$IFn$_invoke$arity$3 (core.js:7889)
	cljs$core$IReduce$_reduce$arity$3 (core.js:11385)
	cljs$core$IFn$_invoke$arity$3 (core.js:7983)
	cljs$core$IFn$_invoke$arity$2 (core.js:18374:82)
	cljs$core$mapv (core.js:18355)
	thi$ng$geom$viz$core$svg_axis_STAR_ (core.js:950:502)
	thi$ng$geom$viz$core$svg_x_axis_cartesian (core.js:968)
	thi$ng$geom$viz$core$svg_plot2d_cartesian (core.js:1063:172)
	**manul_frontend$core$github (core.js:660:274)**
	manul_frontend$core$home_page (core.js:687:1182)
	G__9104__1 (core.js:3733:125)
	G__9104 (core.js:3886)
	(anonymous function) (component.js:127)
	reagent$impl$component$wrap_render (component.js:150)
	reagent$impl$component$do_render (component.js:196)
	(anonymous function) (component.js:222)
	reagent$ratom$in_context (ratom.js:61)
	reagent$ratom$deref_capture (ratom.js:70)
	reagent$ratom$run_in_reaction (ratom.js:1424)
	home-page_render (component.js:220)
	measureLifeCyclePerf (react-dom.inc.js:4529)
	_renderValidatedComponentWithoutOwnerOrContext (react-dom.inc.js:5249)
	_renderValidatedComponent (react-dom.inc.js:5276)
	performInitialMount (react-dom.inc.js:4816)
	mountComponent (react-dom.inc.js:4712)
	mountComponent (react-dom.inc.js:11542)
	mountChildren (react-dom.inc.js:10429)
	_createInitialChildren (react-dom.inc.js:6164)
	mountComponent (react-dom.inc.js:5983)
	mountComponent (react-dom.inc.js:11542)
	performInitialMount (react-dom.inc.js:4825)
	mountComponent (react-dom.inc.js:4712)
	mountComponent (react-dom.inc.js:11542)
	performInitialMount (react-dom.inc.js:4825)
	mountComponent (react-dom.inc.js:4712)
	mountComponent (react-dom.inc.js:11542)
	mountComponentIntoNode (react-dom.inc.js:9757)
	perform (react-dom.inc.js:14724)
	batchedMountComponentIntoNode (react-dom.inc.js:9779)
	perform (react-dom.inc.js:14724)
	_renderNewRootComponent (react-dom.inc.js:9973)
	_renderSubtreeIntoContainer (react-dom.inc.js:10054)
	reagent$dom$render_comp (dom.js:49)
	cljs$core$IFn$_invoke$arity$3 (dom.js:121)
	reagent$dom$render (dom.js:102)
	cljs$core$IFn$_invoke$arity$2 (dom.js:112)
	reagent$dom$render (dom.js:98)
	cljs$core$IFn$_invoke$arity$2 (core.js:182)
	reagent$core$render (core.js:168)
	manul_frontend$core$mount_root (core.js:750)
	cljs$core$IFn$_invoke$arity$2 (core.js:13060)
	cljs$core$apply (core.js:13028)
	G__35851__delegate (build_app.js:11)
	cljs$lang$applyTo (build_app.js:27)
	cljs$core$IFn$_invoke$arity$2 (core.js:13057)
	cljs$core$apply (core.js:13028)
	(anonymous function) (file_reloading.js:2046)

Can I drop in a replacement for byte-array? I used int64 because int32 is not available in the CLJS version of ndarray.

  1. I've also tried binding commits to my raw data in the actual example hm-github.clj (so running on Clojure, not ClojureScript) and it actually doesn't work, saying CompilerException java.lang.IllegalArgumentException: Value out of range for byte: 228, compiling:(/Users/farhan/code/geom/geom-viz/babel/examples/hm-github.clj:57:1) - I definitely never had 228 commits in a day! But I guess the use of a byte array assumes a certain number of commits per day? Maybe if you can talk me through generally what's happening in this code I can fix it myself...

It's worth mentioning that my timestamp data is from another source, not GitHub commits. Here is the data as a list:

(1467504000 1467504000 1467849600 1467936000 1467936000 1468108800 1468108800 1468108800 1468108800 1468108800 1468368000 1468368000 1468454400 1468454400 1468454400 1468454400 1468454400 1467849600 1468627200 1468627200 1468627200 1479600000 1468540800 1468540800 1468713600 1468713600 1468713600 1468886400 1468886400 1468972800 1468972800 1469059200 1469059200 1469059200 1469145600 1469232000 1469232000 1469232000 1469577600 1469577600 1469750400 1469750400 1470182400 1470182400 1470268800 1470268800 1470268800 1470268800 1470355200 1470355200 1470528000 1470528000 1470528000 1470528000 1471132800 1471132800 1471132800 1471478400 1471478400 1471478400 1473292800 1473292800 1473292800 1473292800 1474416000 1474416000 1476316800 1476316800 1476316800 1476316800 1477094400 1477094400 1477699200 1477699200 1477785600 1477785600 1477785600 1477958400 1477958400 1477958400 1478044800 1478044800 1478044800 1478044800 1478131200 1478131200 1478131200 1478217600 1478217600 1478304000 1478304000 1478390400 1478390400 1478649600 1478649600 1478736000 1478736000 1478736000 1478822400 1478822400 1478908800 1478908800 1478908800 1478908800 1478908800 1478908800 1478908800 1478908800 1478908800 1478908800 1479254400 1479254400 1479254400 1479340800 1479340800 1479340800 1479600000 1479600000 1479600000 1479600000 1479600000 1479600000 1479600000 1479600000 1479600000 1479686400 1479686400 1479686400 1486771200 1486771200 1486857600 1486857600 1486944000 1486944000 1487203200 1487203200 1487203200 1487376000 1487376000 1487376000 1487721600 1487721600 1487894400 1487894400 1487894400 1487894400 1487894400 1487894400 1487894400 1487894400 1487980800 1487980800 1487980800 1488240000 1488326400 1488326400 1488326400 1488412800 1488412800 1488412800 1488412800 1488758400 1488758400 1488758400 1488931200 1488931200 1488931200 1489363200 1489363200 1489363200 1489536000 1489536000 1490227200 1490227200 1490227200 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490400000 1490832000 1490832000 1490832000 1491696000 1491696000 1492214400 1492214400 1492819200 1492819200 1492819200 1492819200 1492819200 1492819200 1492819200 1495065600 1495065600 1495065600 1495324800 1495324800 1495324800 1495324800 1495324800 1495411200 1495411200 1496275200 1496275200 1496275200 1496275200 1497830400 1497830400 1497830400 1498262400 1498262400 1498262400 1498262400 1498262400 1498262400 1498262400 1498262400 1498262400 1498262400 1498262400 1498694400 1498694400 1498694400 1499558400 1499558400 1500681600 1500681600 1500681600 1500681600 1500681600 1500681600 1500681600 1501891200 1501891200 1502064000 1502064000 1502064000 1502323200 1502323200 1502323200 1502928000 1502928000 1502928000 1502928000)

Thanks for any help you can give.

Alternatively, could you maybe show me the code for this stuff on the thi.ng homepage?

screen shot 2017-08-29 at 23 14 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant