Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sunburst Child's color #212

Merged
merged 5 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## NeoDash 2.1.6
New features:
- Added *Radar Charts/Spider Charts*.
- Added optional markdown description for each report, to be displayed via the header.

Extensions:
- Added option to provide a custom map provider for map charts.
- Added support for default values in parameter selectors.
- Added documentation on deep-linking into NeoDash.
- Added tick-rotation customization for line charts.
- Added option to have children in the sunburst chart inherit colors from their parents.

Improvements:
- Rewiring of the internal query/rendering engine - resulting in far fewer query executions and a smoother UX.
- Changed package manager from `npm` to `yarn`, and bumped node version to 18. Cleaned up `package.json`.
- Reduced flaky behaviour in parameter selectors.
- Added cycle-detection logic for sankey charts.
- Fixed report documentation pop-up to open link in a new window.

## NeoDash 2.1.5
Added *New* Sankey charts:
- Visualize nodes and relationships as a flow diagram.
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/ROOT/pages/user-guide/reports/sunburst.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ an arc needed to display a label (if labels are enabled).
|Slice Corner Radius |number |3 |The rounding angle of each of the arcs
in the visualization.

|Inherit color from parent |on/off |on |If enabled, starting from level 2, each
level will inherit the same color of his parent. If disabled, color will be randomly
assigned based on the color scheme.

|Auto-run query |on/off |on |When activated, automatically runs the
query when the report is displayed. When set to `off', the query is
displayed and will need to be executed manually.
Expand Down
8 changes: 7 additions & 1 deletion release-notes.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
## NeoDash 2.1.6
New features:
- Added *Radar Charts/Spider Charts*.
- Added optional markdown description for each report, to be displayed via the header.

Extensions:
- Added option to provide a custom map provider for map charts.
- Added support for default values in parameter selectors.
- Added documentation on deep-linking into NeoDash.
- Added tick-rotation customization for line charts.
- Added option to have children in the sunburst chart inherit colors from their parents.

Improvements:
- Rewiring of the internal query/rendering engine - resulting in far fewer query executions and a smoother UX.
- Changed package manager from `npm` to `yarn`, and bumped node version to 18. Cleaned up `package.json`.
- Reduced flaky behaviour in parameter selectors.
- Added cycle-detection logic for sankey charts.

- Fixed report documentation pop-up to open link in a new window.

For a complete version history, see the [Changelog](https://github.com/neo4j-labs/neodash/blob/master/changelog.md).
10 changes: 8 additions & 2 deletions src/chart/sunburst/SunburstChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const NeoSunburstChart = (props: ChartProps) => {
}
const records = props.records;
const selection = props.selection;
const [data, setData] = useState(undefined);
useEffect(() => {
setData(commonProperties.data);
}, [props.selection]);
Expand All @@ -32,10 +31,15 @@ const NeoSunburstChart = (props: ChartProps) => {
// Where a user give us just the tree starting one hop away from the root.
// as Nivo needs a common root, so in that case, we create it for them.
const commonProperties = { data: dataPre.length == 1 ? dataPre[0] : { name: "Total", children: dataPre } };

const [data, setData] = useState(commonProperties.data);

if(data == undefined){
setData(commonProperties.data);
}


const [back, setBack] = useState(false);
const settings = (props.settings) ? props.settings : {};
const legendHeight = 20;
const marginRight = (settings["marginRight"]) ? settings["marginRight"] : 24;
Expand All @@ -45,10 +49,11 @@ const NeoSunburstChart = (props: ChartProps) => {
const enableArcLabels = (settings["enableArcLabels"] !== undefined) ? settings["enableArcLabels"] : true;
const interactive = (settings["interactive"]) ? settings["interactive"] : true;
const borderWidth = (settings["borderWidth"]) ? settings["borderWidth"] : 0;
const legend = (settings["legend"]) ? settings["legend"] : false;
const legend = (settings["legend"] !== undefined) ? settings["legend"] : false;
const arcLabelsSkipAngle = (settings["arcLabelsSkipAngle"]) ? settings["arcLabelsSkipAngle"] : 10;
const cornerRadius = (settings["cornerRadius"]) ? settings["cornerRadius"] : 3;
const colorScheme = (settings["colors"]) ? settings["colors"] : 'nivo';
const inheritColorFromParent = (settings["inheritColorFromParent"] !== undefined) ? settings["inheritColorFromParent"] : true;

if(!data || !data.children || data.children.length == 0){
return <NoDrawableDataErrorMessage />;
Expand Down Expand Up @@ -80,6 +85,7 @@ const NeoSunburstChart = (props: ChartProps) => {
enableArcLabels={enableArcLabels}
borderWidth={borderWidth}
cornerRadius={cornerRadius}
inheritColorFromParent = {inheritColorFromParent}
margin={{
top: marginTop,
right: marginRight,
Expand Down
6 changes: 6 additions & 0 deletions src/config/ReportConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,12 @@ export const REPORT_TYPES = {
type: SELECTION_TYPES.NUMBER,
default: 3
},
"inheritColorFromParent": {
label: "Inherit color from parent",
type: SELECTION_TYPES.LIST,
values: [true, false],
default: true
},
"autorun": {
label: "Auto-run query",
type: SELECTION_TYPES.LIST,
Expand Down