简体   繁体   中英

Configuring background labels

I need to changes background labels in Elessar , does anyone know the parameter to changes the default values? It's actually showing in the format YYYY-MM-DD HH:mm , and I only need HH:mm .

Since version 1.7, there's a new bgMarks option:

bgMarks: {
  count: 0, // number of value labels to write in the background of the bar
  interval: Infinity, // provide instead of count to specify the space between labels
  label: id // string or function to write as the text of a label. functions are called with normalised values.
}

For your use case, you'd want (assuming you're using Moment.js):

bgMarks: {
  count: 4,
  label: function(val) {
    return moment(val).format('HH:mm');
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM