Skip to content

wcharczuk go‐chart Migration Guide

Mike Jensen edited this page Jan 12, 2025 · 3 revisions

This page serves as the migration guide for updating from the archived wcharczuk/go-chart project to the current version of go-analyze/charts. Once complete, future update instructions will be provided in the go-analyze/charts Version Migration Guide.

Current fork status

Users of wcharczuk/go-chart can switch to our project with minimal code changes and render their graphs in the same way they have been. The entire contents of wcharczuk/go-chart are included under the chartdraw package.

We have been carefully reviewing wcharczuk/go-chart, focusing on adding testing and fixing bugs. Our efforts have primarily targeted the API under the charts package, so changes to our chartdraw package have been minimal. Eventually, we aim to unify the APIs, but first, we want to ensure we clearly understand the advantages provided by go-chart.

If you're migrating, we would love to hear from you. Open an Issue and tell us what you liked about wcharczuk/go-chart, as well as anything you do or do not like about our charts configuration or the styling of our graphs.

Code changes to use our chartdraw package

  • RendererProvider no longer returns an error. Calling PNG(int, int) Renderer or SVG(int, int) Renderer to construct a Renderer now can be done without needing to check for any errors. There is no risk of panic or unchecked errors in this change.

  • Font configuration has been moved out as top-level fields of Style and instead requires the FontStyle struct to be initialized to define font specifics (see PR #15).

  • drawing.ColorFromRGB has been deprecated. Use drawing.ColorFromRGBA to parse both RGB and RGBA strings. A more flexible parsing API is also available from charts.ParseColor, accepting RGB, RGBA, hex, and common color names. (See this commit)