package com.example.components;

import java.util.List;
import java.util.Map;

public abstract class AxisChart extends ApexChart {

    protected AxisChart(String chartType) {
        super(chartType);
    }

    public void setData(String seriesName, List<Double> values, List<String> categories) {
        Map<String, Object> options = DialectTheme.baseOptions(getChartType());
        options.put("series", List.of(Map.of("name", seriesName, "data", values)));
        options.put("xaxis", Map.of(
                "categories", categories,
                "axisBorder", Map.of("show", false),
                "axisTicks", Map.of("show", false)
        ));

        sendOptions(options);
    }
}
