feat: диаграммы как формулы — геометрия из семантики DrawingML вместо подгонки под растр Word #21
@@ -116,6 +116,13 @@ final class ChartSpec {
|
||||
double depthPercent = 100;
|
||||
double perspective = 30;
|
||||
boolean rightAngledAxes = true;
|
||||
// Спека-параметры DrawingML, исполнение Word; дефолты — ECMA-376/Word.
|
||||
// firstSliceAng для PIE3D не читается: в JAXB-модели docx4j 17.3.2
|
||||
// у CTPie3DChart геттера CTFirstSliceAng нет.
|
||||
double firstSliceAng = 0;
|
||||
double holeSize = 50;
|
||||
double gapWidth = 150;
|
||||
double overlap = 0;
|
||||
final List<Color> bandColors = new ArrayList<>();
|
||||
boolean wireframe;
|
||||
Color chartFill = Color.WHITE;
|
||||
@@ -219,8 +226,8 @@ final class ChartSpec {
|
||||
}
|
||||
}
|
||||
|
||||
private static void readGroup(Object group, ChartSpec spec, DrawMlColor colors,
|
||||
List<Color> palette) {
|
||||
static void readGroup(Object group, ChartSpec spec, DrawMlColor colors,
|
||||
List<Color> palette) {
|
||||
if (group instanceof CTPie3DChart g) {
|
||||
spec.type = Type.PIE3D;
|
||||
for (CTPieSer s : g.getSer()) {
|
||||
@@ -228,11 +235,20 @@ final class ChartSpec {
|
||||
}
|
||||
} else if (group instanceof CTPieChart g) {
|
||||
spec.type = Type.PIE;
|
||||
if (g.getFirstSliceAng() != null) {
|
||||
spec.firstSliceAng = g.getFirstSliceAng().getVal();
|
||||
}
|
||||
for (CTPieSer s : g.getSer()) {
|
||||
spec.series.add(readPieSer(s, colors));
|
||||
}
|
||||
} else if (group instanceof CTDoughnutChart g) {
|
||||
spec.type = Type.DOUGHNUT;
|
||||
if (g.getFirstSliceAng() != null) {
|
||||
spec.firstSliceAng = g.getFirstSliceAng().getVal();
|
||||
}
|
||||
if (g.getHoleSize() != null) {
|
||||
spec.holeSize = g.getHoleSize().getVal();
|
||||
}
|
||||
for (CTPieSer s : g.getSer()) {
|
||||
spec.series.add(readPieSer(s, colors));
|
||||
}
|
||||
@@ -257,6 +273,13 @@ final class ChartSpec {
|
||||
&& g.getBarDir().getVal() != null
|
||||
&& "bar".equalsIgnoreCase(g.getBarDir().getVal().value());
|
||||
spec.type = horizontal ? Type.BAR_HORIZONTAL : Type.BAR;
|
||||
// getVal() у CTGapAmount/CTOverlap — примитив, проверяется только обёртка
|
||||
if (g.getGapWidth() != null) {
|
||||
spec.gapWidth = g.getGapWidth().getVal();
|
||||
}
|
||||
if (g.getOverlap() != null) {
|
||||
spec.overlap = g.getOverlap().getVal();
|
||||
}
|
||||
for (CTBarSer s : g.getSer()) {
|
||||
Series ser = new Series();
|
||||
readCommon(s.getTx(), s.getCat(), s.getVal(), s.getDPt(), ser, colors);
|
||||
|
||||
Reference in New Issue
Block a user