Skip to content

Instantly share code, notes, and snippets.

View paodb's full-sized avatar

Paola De Bartolo paodb

View GitHub Profile
@paodb
paodb / LineChartWithContextMenu.java
Last active June 13, 2025 17:40
An example on how to open a context menu on a Vaadin Chart point click by using a hidden dummy target component positioned at the click location. Tested on Vaadin 24.7.6.
import com.vaadin.flow.component.charts.Chart;
import com.vaadin.flow.component.charts.model.Configuration;
import com.vaadin.flow.component.charts.model.HorizontalAlign;
import com.vaadin.flow.component.charts.model.LayoutDirection;
import com.vaadin.flow.component.charts.model.Legend;
import com.vaadin.flow.component.charts.model.ListSeries;
import com.vaadin.flow.component.charts.model.PlotOptionsSeries;
import com.vaadin.flow.component.charts.model.VerticalAlign;
import com.vaadin.flow.component.charts.model.YAxis;
import com.vaadin.flow.component.contextmenu.ContextMenu;
@paodb
paodb / VariablePie.java
Created March 11, 2025 01:37
An example on how to implement Variable Pie Chart using Vaadin Charts in Vaadin 24. Importing the right module and extending some existing classes makes possible to implement this chart variant. At this point there's no API in Vaadin Charts to create this kind of chart directly. Implemented example based on https://www.highcharts.com/demo/highch…
package org.vaadin.example;
import com.vaadin.flow.component.charts.Chart;
import com.vaadin.flow.component.charts.model.ChartType;
import com.vaadin.flow.component.charts.model.Configuration;
import com.vaadin.flow.component.charts.model.Cursor;
import com.vaadin.flow.component.charts.model.DataSeries;
import com.vaadin.flow.component.charts.model.DataSeriesItem;
import com.vaadin.flow.component.charts.model.PlotOptionsPie;
import com.vaadin.flow.component.charts.model.Tooltip;