resolve static method

ChartConfig resolve(
  1. ChartConfig config, {
  2. ChartTheme? theme,
})

Resolves theme + chrome defaults for the active template.

Implementation

static ChartConfig resolve(ChartConfig config, {ChartTheme? theme}) {
  if (config.template == ChartTemplateStyle.plain) {
    return config.copyWith(theme: theme ?? config.theme);
  }

  final resolvedTheme = theme ?? config.theme ?? dashboardTheme();
  final series = _enhanceSeries(config.series, resolvedTheme);
  final nonCartesian = _isNonCartesian(config);

  return config.copyWith(
    theme: resolvedTheme,
    series: series,
    showGrid: nonCartesian ? false : config.showGrid,
    showAxis: nonCartesian ? false : config.showAxis,
    showBorder: true,
    showLegend: config.showLegend || _shouldShowLegend(config),
    barBorderRadius: config.barBorderRadius < 4 ? 6 : config.barBorderRadius,
  );
}