I wonder if it is possible to use d3.v4 and d3.v3 at the samme time by renaming the global object d3 for example? I swchited to v4 but I need to merge a v3 and v4 project. I would like to rename v4 and use it independently. Is it possible?
Thanks
Related
I am trying to reproduce and combine the D3 v3 Hierarchical edge bundling tree-map with the D3 v4 Zoomable Tree-map. I'd like to transfer the code logic that draws the link lines to the zoomable tree-map. I'm currently having difficulty finding the D3 v4 equivalent implementation of "d3.layout.bundle()". I have tried d3.bundle() but that just simply fails. I have tried simply copying the v3 line "var bundle = d3.layout.bundle()" but this also fails when referencing v4 library, with the error "Cannot read properties of undefined (reading 'bundle')"
Where as D3 v3 d3.layout.treemap has been ported to d3.treemap, there does not seem any direct equivalent for d3.layout.bundle.
I've just started learning D3. It's at version 4 now and unfortunately most of the tutorials and examples online are of version 3.
I'm trying to create circles. But can't seem to get the attr method to work. I've created fiddles, simplified to render just one circle;
D3 v3 : https://jsfiddle.net/pratheepraj/595rrqc2/
D3 v4 : https://jsfiddle.net/pratheepraj/Ldokhq2e/2/
As you can see the exact code works in v3 but not in v4. In v4 if you inspect the element, the circles get created but the attributes are not set. Could u guys point out what should be changed for v4.
In D3 v4 you have two options:
Use .attr with a single attribute (see working example here: https://jsfiddle.net/yxprgokp/1/)
Use .attrs with attributes as an object, and an extra plugin to do that (https://github.com/d3/d3-selection-multi):
This module is not included in the default D3 bundle for parsimony’s sake: the single-value methods such as selection.attr are recommended for most users, as there is little benefit to the shorter syntax provided by these convenience method.
Original issue on GitHub: https://github.com/d3/d3/issues/2793
I found this link
http://www.nytimes.com/interactive/2015/07/24/business/international/the-world-according-to-china-investment-maps.html?_r=1
It is also interactive.
Can I know what lib they are using?
Looking at the Javascript assets, it looks like it's loading d3.js and topojson. The map itself is an SVG, so likely generated using D3.
this page use one js file for draw chart : chartbeat.js
download chartbear.js
I have about 500 XY points which I would like represent as line using DHTMLXChart. Apparently the only suitable chart (scatter) do not allowing to do it. Any idea how to solve this issue?
There is no native way to do this.
You could use line chart with markers:
Example
Ok on that confirmation you're not bound to a DHTMLX, I would go with Google Charts it's based on opinion, but more importantly on functionality.
The Google Charts API is very easy to work with as it takes raw Javascript data and applies it to the chart and that data may be shoved into multidimensional arrays or as I prefer, JSON Data.
Additionally the Google Charts API has what you are after which is located at https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart or alternatively...
https://developers.google.com/chart/interactive/docs/gallery/scatterchart
P.S. It may be a hefty documentation to read, but learning Google Charts API pays dividends and this would Replace DHTMLX instead of being an additional plugin.
Hope that helps.
I like the d3 sortable bar chart example:
Unfortunately, it doesn't appear to work correctly in v2 (the example uses v3). At first, I thought it was me, so wrote a new example from scratch. Alas, it wasn't! In v2 the x axis labels don't transition with the bars; in v3 both labels and bars transition together.
Can anyone suggest a workaround for v2?
Thanks in advance.
Okay, I think there are two solutions to this problem. As Robert Harvey pointed out, you could use v3. The main difference that I can see so far is that d3.tsv (and possibly the other read data methods) take an additional parameter: this was what was causing the other parts of my code to fail. So, even though v3 isn't the latest release, this is my preferred solution.
The second solution is to transition the axis labels explicitly. This would take more code and as v3 is (hopefully!) on the horizon, might only be necessary if you really can't wait and absolutely must use v2.