dmke opened a new issue, #21324: URL: https://github.com/apache/echarts/issues/21324
### Version 6.0.0 ### Link to Minimal Reproduction https://echarts.apache.org/examples/en/editor.html?c=bar-simple&code=MYewdgzgLgBAJgQygiBTKBlEBXATsVGAXhgG0AoGMgckSlWoBoZqFcoBLYAG0IEYmLNpx6EATINbsuvGAGZqAXUaUaYgAxiArAFp1fPQOZ9165hrMww2bt2WrS1Ddr1jDgk33P7mc_fapHZ111OXdma1sIm25fUIC1TRCAFnCYE2ToqPl1ZMVyRQBucnJQSFg0XA5UCAARJARiMlUAb1UqKABPAAdUAC4WACM2JnarBABbfqFpUXTRqipoBGAAawHqCGwJgH0wdAXFugQBikXFoKTDNJN1BPPLl00b_xVzwKcr0LTIuzf3x4pF55Mb5KgAX3-bXOXV6G2GuEOVDAk2mUhEsgk_yWyDWGy2u32UCR8AapzGH2C130ggs9wunyebhp3j49MpXzCLKsMXZiSeqW5vzBixFkNaY1haIRJJRUw2whkhAU2JgyzxLAJewOquO5Pe_JCBiFvNVHKZaT8bLNhr0XKMOTkfMBekFDr8IPOYoKxVK4GgpOQaCgAHlupxwE1oTAAB4AQRjHAgAxaMClG04U2oMHFVE6CaTKdzMF4AHNUGA4EX_lAQCBuJxuim01VS-XcArExBBAguwAFEAcMD0DswVPpzUACwQcBAAHds-Cc_9jsGU2MIDh8NNV-gsHgCKrKtUIAAJVAz1CjqC4bCoVTF481fWLcc9aUjZjq9aa7ba4nLmMb5wkMn5qriP6bH-RKLqqwEfoiX4Qfi0EHDmqj5OCvplAGT51A0YYRmAUaqPGXbNhO1CZgwgF5gWyZjsWZYVlWjE1nWDYcE2Y4thwbZXp2SY9v2g7DgJPGURA06zguOa0WqV4ngMeH1Mg5BYSUAD0mlppOSYKagEwQGmIAwHOIC4Os5DaSA4YcJGJAqQRdngFpOlQHpxmzjUYBUX05C2URTS7qGLlgEAA ### Steps to Reproduce I have an SQL data source, which gives me data in the following form: ```js const sqlQuery = ` select generate_series::date as "date", invoices.article_id, sum(invoices.total_net) as sum_net from generate_series('2025-01-01'::date, '2025-04-01'::date, '1 month'::interval) join invoice_positions on date_trunc('month', invoice_positions.date) = generate_series::date group by generate_series::date as date, invoices.article_id `; const sqlResult = [ ['date', 'article_id', 'sum_net'], ['2025-01-01', 1, 100], ['2025-01-01', 2, 200], ['2025-01-01', 3, null], ['2025-02-01', 1, 101], ['2025-02-01', 2, 201], ['2025-02-01', 3, 301], ['2025-03-01', 1, null], ['2025-03-01', 2, null], ['2025-03-01', 3, 303], ['2025-04-01', 1, 104], ['2025-04-01', 2, null], ['2025-04-01', 3, 304] ]; ``` After some processing, I currently transfer this data to the client: ```js const fetchedData = { columns: [ { id: 'date', type: 'date' }, { id: 'article_id', type: 'ref' }, { id: 'sum_net', type: 'currency' } ], rows: [ ['2025-01-01', 1, 100], ['2025-01-01', 2, 200], ['2025-01-01', 3, null], ['2025-02-01', 1, 101], ['2025-02-01', 2, 201], ['2025-02-01', 3, 301], ['2025-03-01', 1, null], ['2025-03-01', 2, null], ['2025-03-01', 3, 303], ['2025-04-01', 1, 104], ['2025-04-01', 2, null], ['2025-04-01', 3, 304] ], refs: { article_id: [ [1, 'article 1'], [2, 'article 2'], [3, 'article 3'] ] } }; ``` Now, to chart this data, I have two options: Either make a `dataset`, or embed `data` in the series. The `dataset.source` and `series[i].data` can be found in the reproduction (as `const datasetSource` and `const `seriesData`). Since `dataset` seems to be specifically for tabular data, this option make sense to me, so I try to setup a chart like this: ``` option = { xAxis: { type: 'time' }, yAxis: {}, legend: {}, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, dataset: { source: datasetSource, seriesHeader: true }, series: [ { type: 'bar', stack: 'sum_net' }, { type: 'bar', stack: 'sum_net' }, { type: 'bar', stack: 'sum_net' } ] }; ``` Using `xAxis: { type: "time" }` makes intuitively sense to me. ### Current Behavior The generated graph looks wrong in multiple places: <img width="613" height="331" alt="Image" src="https://github.com/user-attachments/assets/1a9dcf5b-cd09-4875-b62a-f560183a6140" /> 1. The x axis starts at 1970-01-01 - Presumably, because some date is parsed as `null`/`NaN`, which get re-interpreted as `new Date(0)`. Not entirely sure. 2. The legend labels are pair-wise concatenated ("date article 1" and "article 2 article 3"). - I have no clue as to how this could have happened. ### Expected Behavior Embedding the data in the series leads to the following graph: <img width="613" height="331" alt="Image" src="https://github.com/user-attachments/assets/35d8177d-c209-4697-88a0-a9778868656e" /> Note: 1. The x axis correctly shows the months, and 2. The legend correctly shows three articles. ### Environment ```markdown - OS: Debian 12 (that should not matter) - Browser: Firefox 144.0, Chrome 141, Chrome 142 beta) - Framework: none ``` ### Any additional comments? _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
