Closed soumak77 closed 6 years ago
Is anyone in the community an expert with d3? I have done what I could to convert to using d3 version 4, however, I am stuck trying to get the sunburst to display properly. If someone could provide me with some tips or sync my PR and get it to work that would be awesome! I feel like it is really close to fully working.
@germanattanasio would anyone on your team be able to spend some time getting this to work?
@aprilwebster can you look at this?
@germanattanasio sure, I can take a stab at it.
I've updated the PR to support using both version 3 and version 4 (defaulting to version 3 for backwards compatibility).
The file src/personality-chart-renderer.js
has moved to src/d3-renderers
, but I will keep it in the PR for now to make the diff easier to read.
I've integrated these changes into my angular app and exposed APIs to make it easy to update the sunburst on data changes without needing to re-create the entire SVG. D3 version 4 support is the last big thing needed before this library is near perfect!
This is looking solid @soumak77!
thanks @germanattanasio! By the way, all the examples can be reduced to 1 file at some point (just needs a touch of jQuery). Started off as only 2 files then snowballed when I added localization and smaller bundles.
@germanattanasio fyi, tests will pass once a new version of personality-trait-names
is published as the pending changes rely on the new standalone modules
I updated all the other libraries on npm.
If you move the example to the docs
folder, I can use that as GitHub pages and have some live documentation that shows how the chart is re-rendered.
We won't call Personality Insights but we can have a text-area where you paste the profile.
What do you think?
@germanattanasio that would be awesome! The PR can be merged at any point as the changes are fully backwards compatible. Hopefully someone with D3 expertise can take a look soon and get version 4 working.
Can you update this PR with what is left so that I can see if someone has the knowledge to continue this.
@germanattanasio PR is ready. As mentioned in my original comment, src/personality-chart-renderer.js
will need to be removed once the PR is merged (or I can do it before). It is just there now to make the diff easier to read.
Let's remove and I will merge this and release it
@germanattanasio done
@germanattanasio I just noticed, the docs will need to be updated to contain 2 different index files, one for D3 version 3 and another for D3 version 4 so that we can include the correct versions of D3 separately. I'll make this change now.
@soumak77 you need to make sure everything that the page needs to load is in the docs
folder.
Try to also use https://cdnjs.com/
for d3 and jQuery. We can use unpkg
for the sunburst lib.
@germanattanasio docs should be good now. There are 2 files that will be used for github pages: index.html
and index-d3v4.html
. The other 2 files (index-test.html
and index-d3v4-test.html
) are used for local testing by running the npm start
command.
I think https://unpkg.com/personality-sunburst-chart@2.2.0/lib/all.js
needs to be https://unpkg.com/personality-sunburst-chart@2.2.0/lib/index.js
@germanattanasio sure, feel free to rename
@germanattanasio want me to submit a PR for that?
yeah. You did all the work already
You should also close the issues you fixed.
Update d3 logic to use version 4 API. There are still issues with displaying the sunburst that need to be worked out.
I added a script to allow viewing changes to the sunburst in the browser. Use the following command to run the build and view the changes:
Most of the conversion from version 3 to version 4 was straight forward. The one area I am uncertain about is converting the partition logic: https://github.com/personality-insights/sunburst-chart/blob/master/src/personality-chart-renderer.js#L555-L574
UPDATE: PR now supports using both version 3 and version 4 (defaulting to version 3 for backwards compatibility). The
d3
dependency has been moved to a dev dependency so that v4 users will not need to download v3 as well. This will not affect users includingd3
in their html (as shown by the example). Those including it in their javascript bundle will need to explicitly addd3
to their list of dependencies (which is likely already done).IMPORTANT: The file
src/personality-chart-renderer.js
has moved tosrc/d3-renderers
, but I will keep it in the PR for now to make the diff easier to read. It should be removed before merging this PR.