Skip to content

Commit

Permalink
feat: report Gantt chart usage (#7057)
Browse files Browse the repository at this point in the history
Co-authored-by: Sascha Ißbrücker <[email protected]>
  • Loading branch information
bwajtr and sissbruecker authored Feb 12, 2025
1 parent a8d4389 commit e0860f0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import com.vaadin.flow.component.charts.util.ChartSerialization;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;
import com.vaadin.flow.internal.UsageStatistics;
import com.vaadin.flow.shared.Registration;

import elemental.json.JsonObject;
Expand Down Expand Up @@ -145,17 +146,24 @@ private void beforeClientResponse(UI ui, boolean resetConfiguration) {
configurationUpdateRegistration = ui.beforeClientResponse(this,
context -> {
drawChart(resetConfiguration);
reportUsage();

if (configuration != null) {
// Start listening to data series events once the chart
// has been
// drawn.
// has been drawn.
configuration.addChangeListener(changeListener);
}
configurationUpdateRegistration = null;
});
}

private void reportUsage() {
final ChartType type = getConfiguration().getChart().getType();
if (type == ChartType.GANTT) {
UsageStatistics.markAsUsed("flow-components/chart/gantt", null);
}
}

JreJsonFactory getJsonFactory() {
if (jsonFactory == null) {
jsonFactory = new JreJsonFactory();
Expand Down

0 comments on commit e0860f0

Please sign in to comment.