Skip to content

Rename and reconsider current label formatting fallbacks #1479

Open

Description

The current value formatting logic is a bit tricky and can be described as a set of fallback options with the following orders and priorities:

Formatter for X axis labels (used for non-multilayer axis):

  1. current axis axisSpec.labelFormat
  2. current axis axisSpec.tickFormat
  3. toString

Formatter for the Y axis labels:

  1. current axis axisSpec.labelFormat
  2. current axis axisSpec.tickFormat
  3. the first seriesSpec.tickFormat for the relative groupId
  4. toString

Formatters for the tooltip header:

  1. Settings.tooltip.headerFormatter
  2. the last X axisSpec axisSpec.tickFormat <--- to fix
  3. toString

Formatters for the tooltip value:

  1. current series seriesSpec.tickFormat
  2. the last Y axisSpec axisSpec.tickFormat <--- to fix
  3. toString

Formatters for the legend value:

  1. current seriesseriesSpec.tickFormat
  2. the last Y axisSpec axisSpec.tickFormat <--- to fix
  3. toString

Formatters for the bar data values:

  1. the last Y axisSpec axisSpec.tickFormat <--- to fix
  2. the first seriesSpec seriesSpec.tickFormat <--- to fix
  3. toString

This brings in a lot of instability and lack of clarity when defining formatters for the various label in the chart.
I'd like to propose the following:

  1. better naming for the various formatters: something along the following lines labelTickFormatter to format axis tick labels, barValueLabelFormatter for bar data values, legendExtraValueLabelFormatters, tooltipValueLabelFormatter and tooltipHeaderValueLabelFormatter
  2. create a clear and logical fallback when not specified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    :axisAxis related issue:dataData/series/scales related issue:legendLegend related issue:stylingStyling related issue:tooltipRelated to hover tooltip:xyBar/Line/Area chart relatedImpact:MediumbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions