chart label transference

I mean that when you export the notebook as a module it gives you a file (like so) that you can open in your preferred JavaScript editor (in my case emacs) where it is usually easy to do text searches.

In the notebook module you have all the cell definition. A big and not very welcoming file at first but then with some colors and indentation, you can see that it is very repetitive and not complicated. It’s just (roughly speaking) a sequence of variable binding.
The xAxis_ip cell was written as:

    main.variable(observer("xAxis_ip")).define("xAxis_ip", ["height","margin","d3","x_ir"], function(height,margin,d3,x_ir){return(
	g => g
	    .attr("transform", `translate(0,${height - margin.bottom})`)
	    .call(d3.axisBottom(x_ir)
		    .tickSizeOuter(0))
    )});

while the xAxis_ir

    main.variable(observer("xAxis_ir")).define("xAxis_ir", ["height","margin","d3","x_ir"], function(height,margin,d3,x_ir){return(
	g => g
	    .attr("transform", `translate(0,${height - margin.bottom})`)
	    .call(d3.axisBottom(x_ir)
		    .tickSizeOuter(0))
    )});

Very similar to what you have in the notebook but, if your editor can highlight identical variables then the repetition of x_ir jumps to the eye. That’s what I mean.

Also, I’m really not a big fan of coding in the navigator and I very happy to have understood this module stuff (check my previous post) today :slight_smile:

2 Likes