Skip to content

Commit ce62312

Browse files
committed
fix: large tome range errors with none format
1 parent 09c7415 commit ce62312

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/components/ReactTimeSeries/ReactTimeSeries.stories.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,23 @@ export const TimeDataFromCSV = () => {
152152
/>
153153
)
154154
}
155+
156+
export const LargeTimeNoneFormat = () => {
157+
return (
158+
<ReactTimeSeries
159+
interface={{
160+
timeFormat: "none",
161+
allowCustomLabels: true,
162+
}}
163+
sample={{
164+
timeData: [
165+
{ time: 0, value: 0 },
166+
{ time: 200, value: 500 },
167+
{ time: 1000, value: 1000 },
168+
{ time: 10000, value: 500 },
169+
],
170+
}}
171+
onModifySample={() => null}
172+
/>
173+
)
174+
}

src/utils/format-time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const formatTime = (time, format, visibleDuration) => {
44
const lessThan3DaysShown = visibleDuration < 1000 * 60 * 60 * 24 * 3
55
if (format === "none")
66
return visibleDuration > 10
7-
? Math.round(time)
7+
? Math.round(time).toString()
88
: time.toFixed(2 - Math.log(visibleDuration) / Math.log(10))
99
if (format === "dates") {
1010
return (

0 commit comments

Comments
 (0)