New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot: labelFormatter issues with graphs #348

c-frater opened this Issue Nov 10, 2016 · 0 comments


None yet
1 participant
Copy link

c-frater commented Nov 10, 2016


When creating a Bar series with y values over 100, the values are formatted by (which is the default axis formatter) as defined by the default labelValuesExtractor

It was expected that setting labelFormatters.y when adding a series would override that formatter but it is not applied, making it impossible to set the label formatter correctly for bar charts without providing a new labelValuesExtractor.

The default label formatter should also probably be hx.identity rather than the axis formatter as it should normally show the actual value.

Expected Behavior

axis.addSeries('bar', {
 labelFormatters: {
   y: function...
   x: function...

Should override the default label formatter

Actual Behavior

The passed in label formatter is ignored and the value is formatted with (the axis formatter)

Possible Fix

The following would probably resolve all the issues in this area:

  • Update Series to have defaults for labelFormatters.x/y
  • Update the default labelValuesExtractor to fall back to hx.identity instead of series.axis.y.formatter()
  • Update thexProperty and yProperty in the default labelValuesExtractor to have defaults of 'x' and 'y'

Steps to Reproduce

const graphSel ='body').append('div')
const graph = new hx.Graph(graphSel.node())
const axis = graph.addAxis({
  x: {
    scaleType: 'discrete'
  y: {
    min: 0

axis.addSeries('bar', {
  title: 'Bar Series 2',
  fillColor: hx.theme.plot.colors[3],
  data: [{ x: 0, y: 111 }],
  labelFormatters: {
    y: hx.identity


Value in label is rendered as 110 instead of 111


For graphs with sensible values (that don't need si formatting), the axis.x/y.formatter can be set to hx.identity, e.g.:


  x: {
    formatter: hx.identity

Your Environment

  • Hexagon Version: 1.8.2

@c-frater c-frater added the Bug label Nov 18, 2016

@c-frater c-frater added this to the Pre 2.0.0 milestone Jul 6, 2018

@c-frater c-frater self-assigned this Jul 11, 2018

@c-frater c-frater added In Review and removed In Review labels Jul 24, 2018

@c-frater c-frater closed this Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment