Skip to content

Version Migration Guide

Mike Jensen edited this page Aug 20, 2025 · 7 revisions

This guide details how to update between go-analyze/charts versions. To upgrade, follow the steps for each version sequentially, starting from your current version. Older versions are at the bottom.

v0.5.Xv0.6.X PLANNED CHANGES:

These are API changes expected in v0.6.0, if these are an issue or you have an opinion on these please open an Issue to discuss.

  • Default constants in chartdraw package currently marked for deprecation removed
  • Font removed from chart configuration structs: BarChartOption, FunnelChartOption, HeatMapOption, HorizontalBarChartOption, LineChartOption, PieChartOption, RadarChartOption, ScatterChartOption - Set the font on specific elements (like Series.Label or Title)
  • YAxisOption.Formatter removed in favor of ValueFormatter function.

v0.4.Xv0.5.X

  • Minimum Go version is now 1.18 to support generics.
  • Chart-specific SeriesList types have been introduced (PR #45) to provide a clearer API and better documentation for each chart's capabilities. While this is a significant change, most users leveraging helper functions like NewSeriesListLine will see minimal impact. The most common change is the renaming of the Data field to Values (or Value for Pie and Funnel charts). If you construct series manually, the types now map as follows:
    • ChartOption - GenericSeriesList
    • LineChartOption - LineSeriesList
    • BarChartOption - BarSeriesList
    • HorizontalBarChartOption - HorizontalBarSeriesList
    • FunnelChartOption - FunnelSeriesList
    • PieChartOption - PieSeriesList
    • RadarChartOption - RadarSeriesList

Removed Deprecated APIs:

  • LineChartOption.SymbolShow replaced with LineChartOption.Symbol (now accepting multiple symbol types)
  • XAxisOption.TextRotation replaced with XAxisOption.LabelRotation
  • YAxisOption.AxisColor has been removed, now configurable through the Theme using WithYAxisColor or WithYAxisSeriesColor (if you want the axis and text to match a specific series color)
  • LegendOption.Icon replaced with LegendOption.Symbol (now accepting more symbols)
  • LegendOption.Data replaced with LegendOption.SeriesNames
  • XAxisOption.Data replaced with XAxisOption.Labels
  • YAxisOption.Data replaced with YAxisOption.Labels
  • XAxisDataOptionFunc replaced with XAxisLabelsOptionFunc
  • YAxisDataOptionFunc replaced with YAxisLabelsOptionFunc
  • Series.Label.Formatter replaced with Series.Label.FormatTemplate
  • Series.Label.Position replaced with SeriesLabelPosition on the chart Options struct (only bar and horizontal bar use this field)
  • SeriesList.GetMinMax removed, use the better Series.Summary() function.
  • Painter.MarkLine replaced with Painter.HorizontalMarkLine
  • drawing.ColorFromRGB replaced with charts.ColorFromRGBA (supporting both formats now)
  • drawing package had several functions expected to be unused externally that were removed

Other API Changes:

  • Helper functions True(), False(), BoolPointer(bool), and FloatPointer(float64) have been replaced by charts.Ptr.
  • LineChartOption.FillArea is now a *bool, set with charts.Ptr(true).
  • HorizontalBarChart.YAxis is now a single struct instead of a slice, as only one y-axis is supported (see PR #40).

v0.3.Xv0.4.X

Config Changes:

  • LegendOptions.Vertical is now a *bool instead of a bool for consistency and to allow for more flexible defaults.
  • LineChartOption.StrokeWidth renamed to LineStrokeWidth for consistency.
  • Removed OutputFormatOptionFunc. Use SVGOutputOptionFunc() or PNGOutputOptionFunc() instead.
  • WidthOptionFunc and HeightOptionFunc were replaced with DimensionsOptionFunc. Similarly, SetDefaultWidth and SetDefaultHeight were replaced with SetDefaultChartDimensions.

Series Changes:

  • SeriesList construction is now more consistent, using type-specific functions (NewSeriesList<Type>). This removes NewSeriesListDataFromValues and NewSeriesFromValues from the public API. Instead of passing a chart type, call the specific function for that type. For easier option struct construction, consider using helpers like New<Type>ChartOptionWithData.
  • The SeriesData struct has been removed. Series values are now referenced directly via a float64 slice.

Painter Changes:

  • All New<Type>Painter functions are now private except for NewPainter, as they are intended for internal use.
  • NewPainter no longer returns an error (error case is impossible).
  • The Renderer type and its New constructor functions are now private. To render a chart, invoke the method directly on a Painter instance:
    • NewBarChartPainter.BarChart
    • NewHorizontalBarChartPainter.HorizontalBarChart
    • NewFunnelChartPainter.FunnelChart
    • NewLineChartPainter.LineChart
    • NewPieChartPainter.PieChart
    • NewRadarChartPainter.RadarChart
    • NewTableChartPainter.TableChart
  • The Painter API has been streamlined to focus on post-render modifications (e.g., drawing arrows, text, shapes). ArrowTop and ArrowBottom were renamed to ArrowUp and ArrowDown. Painter methods no longer return a Painter instance unless the action applies only to the returned instance.
  • Painter styling (fill color, stroke width, etc.) is no longer stateful. Style attributes are now passed as arguments to the relevant functions.

Many public functions and structs were made private in PR #27. If you relied on any of this functionality, please open an issue.

v0.2.Xv0.3.X

  • Removed NewLegendOption, NewXAxisOption, and NewYAxisOptions. Instantiate these configuration structs directly.
  • The Orient string configuration was replaced with a Vertical boolean.
  • Legend and Title Top and Left configurations were moved into the Offset field (which takes an OffsetStr struct).
  • Where PositionLeft, PositionCenter, or Right were used, you can now use OffsetLeft, OffsetCenter, or OffsetRight to set the Offset field.

v0.1.Xv0.2.X

  • Font, FontSize, and FontColor configurations have been moved into a FontStyle struct.

v0.0.Xv0.1.X

General Changes

  • Type was renamed to OutputFormat to better describe the rendered chart format.
  • Heavier theme use - color specifications that were already possible to derive from the theme have been removed, instead the theme centralizes the styling.
  • TrueFlag() and FalseFlag() were renamed to True() and False().
  • NewFloatPoint(float64) was renamed to FloatPointer.
  • Fields named *Options or *Option have dropped that suffix. E.g., YAxisOptionsYAxis.

Axis-Specific Changes

  • FirstAxis was renamed to DataStartIndex.
  • StrokeColor and SplitLineColor were removed in favor of theme-based colors. Use WithAxisColor(Color) to customize the axis color in a theme.
  • The y-axis Color field was renamed to AxisColor. Modifying the theme with WithAxisColor(Color) is the preferred approach.

Chart-Specific Changes

  • Line chart Opacity was renamed to FillOpacity.
  • For Grid and Table charts, Column and Row were pluralized to Columns and Rows.
  • For Table charts, Padding was renamed to CellPadding.

Theme and Font Changes

  • The theme implementation is now color-only, making the ColorPalette immutable. Fonts and font sizes must be configured separately from the theme.
  • Theme ColorPalette and Font are now set directly instead of by name.
  • FontFamily has been removed (except for ECharts JSON imports). Set the font directly using GetFont(Family).