I'm trying to render a visualization with dc.js that responds immediately to brushmove events.
It seems that dc.js charts will only re-render when the brush stops moving (example with dc brushend rendering), instead of simultaneous with the brush movement (example with brushmove rendering).
Is there any way to modify this behavior so that all dc charts will re-render simultaneously with the brush movement?
If you look closely, the charts do actually update as you move the brush. However, each dc.js chart by default has a transition set, as you can see in the dc.js docs: transitionDuration, which controls the transition time, is set to 750 for all charts.
To change this, set transitionDuration to 0, which is the same as disabling transitions:
chart.transitionDuration(0)
Related
Does the Nivo charts library allow on-load animations for pie charts? I have only been able to get on-load animations for bar charts, but not for pie charts.
Nivo has a transition mode property which gives animation when a chart node is clicked. I need the animation to show on component load. Is there a workaround for this or has anyone managed to get this feature to work before? My pie chart is a react js storybook component.
This seems to be a difficult problem to solve. Nivo has an outstanding issue out where they made some progress, but based on the final postings the initial draw still has issues. I was able to force an initial render with a little help from window.setTimeout() but the animation ends up warping the circle, I'm guessing that is why it doesn't work by default.
I tried Victory.js and it also has the exact same issue. You can use this technique in React.js to force the initial draw.
My solution was to move to react-chartjs-2, which worked right out of the box.
https://react-chartjs-2.js.org/components/doughnut/
New to D3 here. I am attempting to combine brush and zoom(ex1) with multiple brushes(ex2).
The idea is that the user will be able to create multiple brushes on top of Ex1's focus chart to make annotations on the data. Which I am able to do. However, I am only able to update one(the first) annotation brush position on the chart after zooming using this on ex2's zoomed function:
.select("#brush-0").call(brushes[0].brush.move, lastSelection.map(t.applyX, t));
Where t is the zoom transform and lastSelection is the selection from the last brush that was created. Very hacky, I know, but at least behaves as expected.
I would like to be able to update all the brushes that are stored in the brushes array after zooming and panning in a way that can be called from the zoomed function. Help!
EDIT:
I have recreated the issue with my (flawed) solution attempt here: jsfiddle.net/0pk8wce9/1
I'm trying to refactor some custom d3 code that I wrote to render a series of crossfilter-driven charts by bringing in dc.js.
My main problem is that I have some chart types that are not supported by dc.js (e.g. a Sunburst Partition) and I'm trying to figure out how to render them in conjunction with a dc.js chart group.
Filtering a single dc.js chart will automatically render / redraw all other charts belonging to the same chartGroup. Is it possible to somehow hook into that global re-render event, so that I can re-draw the non-dc charts at the same time?
I understand that there are listeners on each individual chart, e.g. chart.on("postRender", function(chart){...}) but there doesn't seem to be a way to hook into re-rendering a group of charts. Is there a good pattern by which this could be accomplished?
The "right" way to do this is to register your chart in the dc registry with dc.registerChart
You just need to implement .redraw() and .render() on some object (your chart or a wrapper), and pass that object as the first argument.
Put it in the same group (second arg) as the charts it should respond to.
render() creates the dom elements from scratch, and redraw() updates them when the data changes.
Depending on how the chart is used, you may also have to implement .filterAll() and .anchorName()
I have a screen where I need to align other controls with the plot lines of a DataViz chart control.
Using Javascript, how can I get the position of the PlotArea of the chart? I'd like to know the offset.left of the chart's plot area and the total PlotArea.width.
None of the properties / methods exposed in JavaScript are apparent.
I have a pie chart which is being generated from a json string. The pie is getting created correctly but what is happening is the tooltip is getting cutoff when the text to be displayed in the tooltip is large. I have tried increasing the width and height of the svg area. But the charts are generated dynamically so i have no way of setting the chart widht and height dynamically depending on the content.
One can adjust the margins margin:[0,100,0,100], to shrink the pie chart so that the tooltips/labels will appear. This has been set to automatically scale the chart in Highcharts 3.0.
http://www.highcharts.com/component/content/article/2-news/53-highcharts-3-0-beta-released
http://github.highcharts.com/v3.0Beta/highcharts.js
http://jsfiddle.net/Zvrt6/1/
Increase Height and width of your chart div or put your code in jsfiddle if possible, so that we can get more idea
This example could be relevant to your situation- http://jsfiddle.net/4ac8b/1/. When you re-size the result pane you will notice the chart size changes accordingly.
You will need to set the size of your container so that the chart is drawn in that area itself. http://jsfiddle.net/4ac8b/. Even when you re-size the result pane the chart size wont change.
Change the diameter of your pie chart to allow additional information
http://www.highcharts.com/ref/#plotOptions-pie--size