|
| 1 | +/* |
| 2 | + * Copyright 2000-2026 Vaadin Ltd. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | + * use this file except in compliance with the License. You may obtain a copy of |
| 6 | + * the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | + * License for the specific language governing permissions and limitations under |
| 14 | + * the License. |
| 15 | + */ |
| 16 | +package com.vaadin.flow.component.ai.chart; |
| 17 | + |
| 18 | +import java.io.Serializable; |
| 19 | +import java.util.List; |
| 20 | +import java.util.Map; |
| 21 | + |
| 22 | +import com.vaadin.flow.component.charts.model.Series; |
| 23 | + |
| 24 | +/** |
| 25 | + * Converts tabular data into chart {@link Series} for rendering. The input is a |
| 26 | + * list of rows, where each row is a column-name-to-value map. |
| 27 | + * <p> |
| 28 | + * Implementations may return one or more series depending on the data. |
| 29 | + * </p> |
| 30 | + * |
| 31 | + * @author Vaadin Ltd |
| 32 | + */ |
| 33 | +public interface DataConverter extends Serializable { |
| 34 | + |
| 35 | + /** |
| 36 | + * Converts tabular data into one or more chart series. |
| 37 | + * <p> |
| 38 | + * Each element in the input list represents a single row, with column names |
| 39 | + * as keys and column values as values. |
| 40 | + * </p> |
| 41 | + * |
| 42 | + * @param data |
| 43 | + * the tabular data to convert, not {@code null} |
| 44 | + * @return a list of series ready for use in a chart, never {@code null} and |
| 45 | + * never empty |
| 46 | + * @throws NullPointerException |
| 47 | + * if data is {@code null} |
| 48 | + */ |
| 49 | + List<Series> convertToSeries(List<Map<String, Object>> data); |
| 50 | +} |
0 commit comments