Can I add a moving scale or axis in plots using Vegalite? - d3.js

I am trying to add a movable scale or axis inside a plot. For instance: in this example of stacked plot: Click-to-view
I want to include a movable y-axis scale so, if we hover the graph and put the mouse pointer on the beginning of the orange color of any bar, the a-xis will begin from that bar. (Specifically, moving x=0 line.)
I meant something like this example (of d3).
https://observablehq.com/#d3/index-chart
But, here I want to change the value of x-axis by moving the line. Is it possible to do it using vegalite? If somebody has any similar example in vegalite, can you refer it?
Thank you!

AFAIK, there is no animation in Vega Lite. However, you may check out Gemini which aims to extend the grammar of data viz to some simple animations of single-view Vega/Vega-Lite charts

Related

How to make a tooltip for a chart in d3?

We need to make it move like here.example The code is complex there, I can't figure it out.
I wrote the code my code, but I don’t understand how to make the tooltip move horizontally not behind the mouse, but near the nearest horizontal mark (as in the example)
It is not yet clear where the text above the bold text in the tooltip comes from. How to remove it so that it looks like in the picture?
How do I make the title of the tooltip match the label on the X-axis?
There are many ways to accomplish this. The way I typically do this is to create a series of SVG elements -- such as circles or rects -- using the same scale and data as the paths.
You can make these objects visible or invisible. Either way, you can attach mouseenter, mouseleave events to each to render and populate the tooltip.

d3.js v4 how to set brush programmatically

I am building a version of this parallel coordinate view in d3.js v4.
https://bl.ocks.org/syntagmatic/05a5b0897a48890133beb59c815bd953
In my example I have a predefined selection (in the form of a [min,max] array that I would like to set programatically as a brush in one or more of the axes, after the plot has loaded. But I cannot seem to find a way to do it. Most examples I found on setting a brush from code are using d3 v3 and use setting extent but that does not work anymore in v4 it seems.
can someone give me some tips and a simple example hot to do this in this case (so with multiple axes and brushes active) ?
thanks
Select your brush group and call brush.move, then also pass an array with the start and end coordinates. Your brush move event will then take care of the rest.
d3.select(".brush").call(brush.move, [[startX, endX], [startY, endY]]);

can you add filterHandler for composite chart, dc.js?

I created a grouped-stacked composite chart using dc.js.
I am wondering if I can add a filterHandler to a composite chart.
I want to filter on each stacks.
It seems that, there is no straight forward way to build a composite chart and hook the parent chart to the volumeChart that would filter all the individual child components at once via dc.js, as Gordon suggested. I came up with a solution for one of my dashboards which is not so modular but works fine & also keep in mind the downsides to this approach pointed out below.
For the above dashboard to work, I defined 3 barCharts and 3 lineCharts overlaid on top the barCharts and chaining them all together linearly to volumeChart.
Although this works fine with a fixed y-axis scale, lineChart fails to align with the barCharts when the I set elasticY(true) on all of them, since the lineChart components seem to pic its own yMax and when I pass the yMax value as window.value from barCharts to the lineChart via .on('renderlet'..., again I fail to read these values due the misalignment of individual chart render times. And of course when I overlay the lineCharts I intrinsically loose/block the interaction with the barCharts and use the line moving average tooltips to view bar data.
I have not tried this yet but found a better way to do the same from Scott Miller - https://stackoverflow.com/a/25188909/5743716
Hope it helps!

nvd3 multibar chart show values

I have a stacked multiBarChart created with nvd3: jsfiddle is here: http://jsfiddle.net/e3kxZ/5/
(1) How can I get each region to display its value near its top?
I tried showValues(true) but I don't think that's supported in multiBarChart.
Other concerns I have are:
(2) how to set the text color so that it contrasts enough with the region (dark vs light colors), and
(3) how to keep the text labels from overlapping if any particular region is small.
I found an svg example (doesn't use nvd3) -- it assumes a static size for the chart, but I'd prefer to use something convenient and dynamic like nvd3.
Alternatively, if there is a different js library that supports this out of the box, please let me know and I'll use that instead.
Thanks in advance for any help!

Extending a crossfilter/d3 example to handle wrapping bar charts

I am in the process of trying to extend Jason Davies' example of crossfilterjs example (you can see it here at http://square.github.io/crossfilter/) to make it able to hand larger data sets. My idea was to make the bar charts wrap.
This is what I have so far: http://bl.ocks.org/elsherbini/5564315
I am trying to figure out how I could make the axis and brush wrap as well. If you open that example in a full window, you can see that right now it just draws the axis at the bottom, and the brush goes over the whole thing. My goal is to make the brush and axis wrap as well, but I'm not sure how to proceed.
Does anyone have experience trying to extend d3.svg.axis() or d3.svg.brush()? Do I need to extend those at all, or is there some other workaround?

Resources