Obtain a sunburst chart visualization for a personality profile. For use in an HTML page.
Include the library index.js script from the /dist folder and D3 in your HTML page.
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js"></script>
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="path/to/index.js"></script> <!-- This is the file in the /dist folder. -->
Create an element to contain the chart in your HTML page.
<div id='sunburstChart'></div>
Generate the visualization for a personality profile.
// Create the chart, specifying the css selector that identifies the element to contain the chart
// and the version of Watson Personality Insights profile to use, v2 or v3. Default is v2.
var chart = new PersonalitySunburstChart({
'selector':'#sunburstChart', 'version': 'v3'
});
// Render the sunburst chart for a personality profile (version as specified in creating the chart)
// and optionally a profile photo. The photo will be inserted into the center of the sunburst chart.
chart.show('jsonObject', 'path/to/profile_photo.jpg');
See the complete example code.
This library is licensed under Apache 2.0. Full license text is available in LICENSE.
26-01-2017
- Removed jQuery
- Add support for selectors and DOM nodes
15-01-2017
- Added support for v3 profiles - d3 tree json wrapper provided for v2 and v3 personality profiles to generate the input required by the d3 sunburst-chart created in lib/personality-chart-renderer.js
- Only traits, needs and values will be displayed by the sunburst-chart.