1

In examples such as this one: https://plot.ly/12/~streaming-demos/, by using the designer tools under axes > Labels > Hover Format I am able to change the format of the time x-axis tooltip to something like "%y/%m/%d %I:%M%p"). How do I achieve the same thing in code?

I have been through the reference (https://plot.ly/javascript/reference/) and can't find anything on this.

1 Answer 1

3

Found the answer. On the plotly designer there is a "View JSON" button which shows the json config object to achieve the effect I wanted.

The below code formats the x-axis (tickformat) and tooltip hover (hoverformat)

var layout = {
  xaxis:{
    tickformat: "%y/%m/%d %I:%M %p",
    hoverformat: "%y/%m/%d %I:%M %p"
  }
}
Plotly.newPlot('myDiv', data, layout);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.