Hi,
I am using plotly js for react library and am facing a issue while using it and no proper documentation or support being raised in the internet , the issue is I want to hide the timezone and show only the date when the char is being zoomed , i cant able to view any properties to remove timezone from the chart co ordinated
dhamodharan-baskar:
plotly js for react library and am facing a issue while using it and no proper documentation or support being raised in the internet , the issue is I want to hide the timezone and show only the date when the char is being zoomed , i cant able to view any properties to remove timezone from the chart co ordinate
This page will help: Formatting ticks in JavaScript
Basically, you want to set the tickformat for your axis.
xaxis: {
tickformat: '%b%d, %Y'
}
You can set tickformatstops if you want to control things by zoom level.
1 Like
Thanks for your valuable reply , is there any way to customize the timezone display , like i dont want to display the seconds and milliseconds , only hours and minutes is enough
Read here for all your options:
# d3-time-format
This module provides a JavaScript implementation of the venerable [strptime](http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html) and [strftime](http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html) functions from the C standard library, and can be used to parse or format [dates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) in a variety of locale-specific representations. To format a date, create a [formatter](#locale_format) from a specifier (a string with the desired format *directives*, indicated by `%`); then pass a date to the formatter, which returns a string. For example, to convert the current date to a human-readable string:
```js
var formatTime = d3.timeFormat("%B %d, %Y");
formatTime(new Date); // "June 30, 2015"
```
Likewise, to convert a string back to a date, create a [parser](#locale_parse):
```js
var parseTime = d3.timeParse("%B %d, %Y");
parseTime("June 30, 2015"); // Tue Jun 30 2015 00:00:00 GMT-0700 (PDT)
```
You can implement more elaborate conditional time formats, too. For example, here’s a [multi-scale time format](http://bl.ocks.org/mbostock/4149176) using [time intervals](https://github.com/d3/d3-time):
```js
var formatMillisecond = d3.timeFormat(".%L"),
This file has been truncated. show original