Skip to content

Commit 01aae04

Browse files
vaadin-botugur-vaadin
andauthoredMar 11, 2025
fix: include annotations in the svg generator (#7181) (#7186)
Co-authored-by: Ugur Saglam <[email protected]>
1 parent 68a3dd9 commit 01aae04

File tree

12 files changed

+25
-9
lines changed

12 files changed

+25
-9
lines changed
 

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/jsdom-exporter.js

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ require("highcharts/modules/timeline")(Highcharts);
4848
require("highcharts/modules/organization")(Highcharts);
4949
require("highcharts/modules/xrange")(Highcharts);
5050
require("highcharts/modules/bullet")(Highcharts);
51+
require("highcharts/modules/annotations")(Highcharts);
5152

5253
win.Date = Date;
5354

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/java/com/vaadin/flow/component/charts/export/SVGGeneratorTest.java

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import org.junit.Before;
2828
import org.junit.Test;
2929

30+
import com.vaadin.flow.component.charts.model.AnnotationItemLabel;
31+
import com.vaadin.flow.component.charts.model.AnnotationItemLabelPoint;
3032
import com.vaadin.flow.component.charts.model.AxisType;
3133
import com.vaadin.flow.component.charts.model.ChartType;
3234
import com.vaadin.flow.component.charts.model.Configuration;
@@ -214,6 +216,18 @@ public void exportWithLargeSeries()
214216
svgGenerator.generate(configuration);
215217
}
216218

219+
@Test
220+
public void exportWithLabel() throws IOException, InterruptedException {
221+
var conf = createPieChartConfiguration();
222+
var label = new AnnotationItemLabel("Blue");
223+
label.setPoint(new AnnotationItemLabelPoint(350, 170));
224+
conf.addLabel(label);
225+
var svg = svgGenerator.generate(conf);
226+
var pieChartPath = Paths.get("src", "test", "resources", "label.svg");
227+
var expectedSVG = readUtf8File(pieChartPath);
228+
assertEquals(replaceIds(expectedSVG), replaceIds(svg));
229+
}
230+
217231
private Configuration createPieChartConfiguration() {
218232
Configuration conf = new Configuration();
219233
conf.setTitle("Browser market shares in January, 2018");

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/column-without-title.svg

+1-1
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/custom-height.svg

+1-1
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/custom-lang.svg

+1-1
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/custom-width.svg

+1-1
Loading
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/enabled-functions.svg

+1-1
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/lumo-dark.svg

+1-1
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/pie.svg

+1-1
Loading

‎vaadin-charts-flow-parent/vaadin-charts-flow-svg-generator/src/test/resources/timeline.svg

+1-1
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.