Skip to content

Commit 735f37d

Browse files
authored
Merge pull request #638 from neo4j-labs/feature/pieFontSize
Pie font size
2 parents 187a99e + 2111a27 commit 735f37d

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

docs/modules/ROOT/pages/user-guide/reports/pie-chart.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ the pie slices in order of size.
4949
|Show Values in Slices |on/off |off |If enabled, show the category
5050
values inside the pie slices.
5151

52+
|Labels font Size |Number |13 |Define the size of the font for internal and external labels on the pie.
53+
5254
|Show categories next to Slices |on/off |off |If enabled, show the
5355
category values next to the pie slices.
5456

src/chart/pie/PieChart.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ChartProps } from '../Chart';
77
import { convertRecordObjectToString, recordToNative } from '../ChartUtils';
88
import { themeNivo } from '../Utils';
99
import { extensionEnabled } from '../../utils/ReportUtils';
10+
import { objMerge } from '../../utils/ObjectManipulation';
1011

1112
/**
1213
* Embeds a PieChart (from Nivo) into NeoDash.
@@ -90,6 +91,8 @@ const NeoPieChart = (props: ChartProps) => {
9091
const cornerRadius = settings.cornerRadius ? settings.cornerRadius : 1;
9192
const arcLabelsSkipAngle = settings.arcLabelsSkipAngle ? settings.arcLabelsSkipAngle : 10;
9293

94+
const arcLabelsFontSize = settings.arcLabelsFontSize ? settings.arcLabelsFontSize : 13;
95+
9396
const legend = settings.legend ? settings.legend : false;
9497
const colorScheme = settings.colors ? settings.colors : 'set2';
9598
const styleRules = useStyleRules(
@@ -131,9 +134,14 @@ const NeoPieChart = (props: ChartProps) => {
131134
return <NoDrawableDataErrorMessage />;
132135
}
133136

137+
const theme = objMerge(themeNivo, {
138+
labels: {
139+
text: { fontSize: arcLabelsFontSize },
140+
},
141+
});
134142
return (
135143
<ResponsivePie
136-
theme={themeNivo}
144+
theme={theme}
137145
data={data}
138146
sortByValue={sortByValue}
139147
enableArcLabels={enableArcLabels}

src/config/ReportConfig.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,11 @@ const _REPORT_TYPES = {
516516
type: SELECTION_TYPES.NUMBER,
517517
default: 10,
518518
},
519+
arcLabelsFontSize: {
520+
label: 'Labels font Size',
521+
type: SELECTION_TYPES.NUMBER,
522+
default: 13,
523+
},
519524
enableArcLinkLabels: {
520525
label: 'Show categories next to slices',
521526
type: SELECTION_TYPES.LIST,

0 commit comments

Comments
 (0)