fusioncharts / fusioncharts-dist

FusionCharts JavaScript Charting library. Over 95+ charts and 1,400+ maps to choose from, with integrations available for all popular JavaScript frameworks & back-end programming languages.
https://www.fusioncharts.com
Other
84 stars 46 forks source link

Timeseries showing wrong data for dates with different time zones #38

Open arcataroger opened 2 years ago

arcataroger commented 2 years ago

Demo: https://fusioncharts-dst-bug.vercel.app/ Minimal reproducible example: https://github.com/arcataroger/fusioncharts-dst-bug/blob/master/src/App.js

Issue Description

image

When a timeseries chart shows daily data points with no time zones specified (the graph labeled "Chart of expected results"), everything seems to work right.

However, if the data includes time zones different from the current browser time, the values and dates seem to become misaligned.

This can happen, for example, when:

Steps to reproduce

Make a timeseries chart with the following dataset:

Data:

[
    ["2022-03-11T00:00:00-08:00", 53.1814],
    ["2022-03-12T00:00:00-08:00", 50.7],
    ["2022-03-13T00:00:00-08:00", 50.2547],
    ["2022-03-14T00:00:00-07:00", 62.9599],
    ["2022-03-15T00:00:00-07:00", 70.7427],
    ["2022-03-16T00:00:00-07:00", 65.3493]
]

Schema:

let schema = [
    {
        name: "Time",
        type: "date",
        format: "%Y-%m-%dT%H:%M:%S%Z"
    },
    {
        name: "Value",
        type: "number"
    }
]
arcataroger commented 2 years ago

This issue concerns 3.18, but it may be related to a similar issue in 3.16. In that version, the display will be incorrect even if the time zone is stripped from the chart data.