Is your feature request related to a problem? Please describe.
It's required to draw piechart and donut chart, with one or multiple levels.
Describe the solution you'd like
- Reuse as much as possible the code already implemented for XY axis
- Use the same
Chart structure but different specs for chart PieChartSeries
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Rendering a piechart is not so difficult, we can just use d3-arcs to compute the paths.
import { arc, pie } from 'd3-shape';
const pieSpec = {
data: [[10],[20], [30]],
accessor: 0,
}
const paths = pie().value((d: any) => {
return d[pieSpec.accessor];
})(pieSpec.data);
// that is the space allowed to render the pie chart we should take in consideration the
// how much space a direct labelling on the chart take
const { width, height } = chartDimensions;
const outerRadius = width < height ? width / 2 : height / 2;
const innerRadius = pieSpec.donut ? outerRadius / 2 : 0;
const arcGenerator = arc();
const arcs = paths.map((path) => {
const arc = arcGenerator({
...path,
innerRadius: innerRadius,
outerRadius: outerRadius,
});
return {
arc: arc === null ? '' : arc,
color: 'red',
transform: {
x: width / 2,
y: height / 2,
},
geometryId: {
specId: pieSpec.id,
seriesKey: [],
},
seriesArcStyle: settings.theme.arcSeriesStyle.arc,
};
});
The difficult part is the label positioning, place labels to avoid overlaps and overflows.
The pre-computing label dimensions will came in handy, but we need a good alghoritm to place them without overlapping them together.
We have to take in consideration also the style of the slices, specially when we will have many small slices.
Consider also label rotations as described here: https://www.amcharts.com/docs/v4/tutorials/labels-inside-pie-chart-slices/
Other interesting references:
Features:
Kibana Cross Issues
Checklist
Is your feature request related to a problem? Please describe.
It's required to draw piechart and donut chart, with one or multiple levels.
Describe the solution you'd like
Chartstructure but different specs for chartPieChartSeriesDescribe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Rendering a piechart is not so difficult, we can just use
d3-arcsto compute the paths.The difficult part is the label positioning, place labels to avoid overlaps and overflows.
The pre-computing label dimensions will came in handy, but we need a good alghoritm to place them without overlapping them together.
We have to take in consideration also the style of the slices, specially when we will have many small slices.
Consider also label rotations as described here: https://www.amcharts.com/docs/v4/tutorials/labels-inside-pie-chart-slices/
Other interesting references:
Features:
Kibana Cross Issues
Checklist
Kibana Cross Issueslistkibana cross issuetag is associated to the issue if any kibana cross issue is present