# Dashboard2 - duplicate values on x axis

**URL:** <https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [23 February 2025 09:24 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588 "2025-02-23T09:24:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [23 February 2025 09:24 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/1 "2025-02-23T09:24:57Z")

</div>

Can somebody help make a quick example of how I can send data for a graph - in a single message - with duplicate labels on the X axis? I cannot seem to make a timescale graph from a message with an array of data points?

I wish to show the hour of the day on the X axis but often for more than a day, such that some hour "names" are duplicated at the beginning and end of the graph.

For example this doesn't seem to work:

```auto
{"id":"5ef1d44eedddfe91","type":"ui-chart","z":"178ed895cc75d9ab","group":"1130e9c196f39867","name":"Plan","label":"Plan","order":2,"chartType":"line","category":"[\"minCharge\", \"normalCharge\", "buy\"]","categoryType":"json","xAxisLabel":"","xAxisProperty":"payload.ts","xAxisPropertyType":"msg","xAxisType":"time","xAxisFormat":"HH","xAxisFormatType":"custom","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"payload","yAxisPropertyType":"msg","ymin":"","ymax":"","bins":10,"action":"replace","stackSeries":false,"pointShape":"false","pointRadius":4,"showLegend":true,"removeOlder":"24","removeOlderUnit":"3600","removeOlderPoints":"33","colors":["#ffd172","#385fff","#cc4c3d","#2ca02c","#a347e1","#d62728","#ff9896","#9467bd","#c5b0d5"],"textColor":["#666666"],"textColorDefault":true,"gridColor":["#e5e5e5"],"gridColorDefault":true,"width":"6","height":"4","className":"","interpolation":"linear","x":1230,"y":480,"wires":[[]]},{"id":"4776f55f1c64640c","type":"inject","z":"178ed895cc75d9ab","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"hour\":\"2025012922\",\"ts\":1738188000000,\"shortHour\":\"22\",\"normalCharge\":0,\"minCharge\":0.7,\"buy\":1.4},{\"hour\":\"2025012923\",\"ts\":1738191600000,\"shortHour\":\"23\",\"normalCharge\":0,\"minCharge\":0,\"buy\":1.35},{\"hour\":\"2025013022\",\"ts\":1738274400000,\"shortHour\":\"22\",\"normalCharge\":0,\"minCharge\":0,\"buy\":1.02}]","payloadType":"json","x":1010,"y":480,"wires":[["5ef1d44eedddfe91"]]},{"id":"1130e9c196f39867","type":"ui-group","name":"Plan","page":"ce0fb242887e2cfe","width":"6","height":"1","order":2,"showTitle":false,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"ce0fb242887e2cfe","type":"ui-page","name":"Bil","ui":"391b382dc05b69b2","path":"/car","icon":"car","layout":"grid","theme":"c20a7e20a4e37ad0","breakpoints":[{"name":"Default","px":"0","cols":"6"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":2,"className":"","visible":true,"disabled":false},{"id":"391b382dc05b69b2","type":"ui-base","name":"Dashboard2","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":false,"notificationDisplayTime":"5","showDisconnectNotification":false},{"id":"c20a7e20a4e37ad0","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"6px","groupGap":"6px","groupBorderRadius":"4px","widgetGap":"6px","density":"default"}}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 February 2025 09:42 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/2 "2025-02-23T09:42:27Z")

</div>

Can you please edit your post so that the code does not get mangled by the forum?

There has to be a line with three backticks before the code and another after it, like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e1cc2883338b592d7c6e3f7f05a41dbe7a334bc.png)

---

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [23 February 2025 09:54 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/3 "2025-02-23T09:54:21Z")

</div>

@jbudd: Thanks. I actually tried that, but it didn't work. I guess I did something wrong - works fine now 🙂

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 February 2025 09:55 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/4 "2025-02-23T09:55:56Z")

</div>

> [@dth](#):
>
> works fine now

Do you mean the flow is now importable or that you have solved your problem?

**[Edit]** It still is not importable for some reason, there is a JSON syntax error. You posted this flow in another post recently and it wasn't importable (by me) then, so something odd is going on.

---

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [23 February 2025 10:10 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/5 "2025-02-23T10:10:05Z")

</div>

@Colin: don't know what went wrong. It was exported from my Node-Red instance, but doesn't work for me either, now that I tried importing it.

In any case: any suggestions on how to reach my goal of duplicated X-axis labels, would be much appreciated 🙂

I tried again, and this seems to work:

```auto
[{"id":"5ef1d44eedddfe91","type":"ui-chart","z":"178ed895cc75d9ab","d":true,"group":"1130e9c196f39867","name":"Plan","label":"Plan","order":2,"chartType":"bar","category":"[\"minCharge\", \"normalCharge\",\"buy\"]","categoryType":"json","xAxisLabel":"","xAxisProperty":"shortHour","xAxisPropertyType":"property","xAxisType":"category","xAxisFormat":"HH","xAxisFormatType":"custom","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"payload","yAxisPropertyType":"msg","ymin":"","ymax":"","bins":10,"action":"replace","stackSeries":false,"pointShape":"false","pointRadius":4,"showLegend":true,"removeOlder":"24","removeOlderUnit":"3600","removeOlderPoints":"33","colors":["#ffd172","#385fff","#cc4c3d","#2ca02c","#a347e1","#d62728","#ff9896","#9467bd","#c5b0d5"],"textColor":["#666666"],"textColorDefault":true,"gridColor":["#e5e5e5"],"gridColorDefault":true,"width":"6","height":"4","className":"","interpolation":"linear","x":1230,"y":480,"wires":[[]]},{"id":"4776f55f1c64640c","type":"inject","z":"178ed895cc75d9ab","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"hour\":\"2025012922\",\"ts\":1738188000000,\"shortHour\":\"22\",\"normalCharge\":1,\"minCharge\":0.7,\"buy\":1.4},{\"hour\":\"2025012923\",\"ts\":1738191600000,\"shortHour\":\"23\",\"normalCharge\":2,\"minCharge\":0.3,\"buy\":1.35},{\"hour\":\"2025013022\",\"ts\":1738274400000,\"shortHour\":\"24\",\"normalCharge\":3,\"minCharge\":0.5,\"buy\":1.02}]","payloadType":"json","x":1010,"y":480,"wires":[["5ef1d44eedddfe91"]]},{"id":"1130e9c196f39867","type":"ui-group","name":"Plan","page":"ce0fb242887e2cfe","width":"6","height":"1","order":2,"showTitle":false,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"ce0fb242887e2cfe","type":"ui-page","name":"Bil","ui":"391b382dc05b69b2","path":"/car","icon":"car","layout":"grid","theme":"c20a7e20a4e37ad0","breakpoints":[{"name":"Default","px":"0","cols":"6"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":3,"className":"","visible":true,"disabled":false},{"id":"391b382dc05b69b2","type":"ui-base","name":"Dashboard2","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":false,"notificationDisplayTime":"5","showDisconnectNotification":false},{"id":"c20a7e20a4e37ad0","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"6px","groupGap":"6px","groupBorderRadius":"4px","widgetGap":"6px","density":"default"}}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 February 2025 10:19 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/6 "2025-02-23T10:19:39Z")

</div>

That works for me

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f785cd06b6db541738047ef1ae5bf2f1ec3c3b4.png)

---

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [23 February 2025 10:35 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/7 "2025-02-23T10:35:42Z")

</div>

I have been messing around with it further, but still with no luck.

What I am trying to do with this example is get two of "22" and one of "23". This is a shortened down example of the case of showing all hours for 1.5 days or so, which is what I ultimately need to do.

Updated to better express the exact issue:

```auto
[{"id":"4776f55f1c64640c","type":"inject","z":"178ed895cc75d9ab","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"hour\":\"2025012922\",\"ts\":1738188000000,\"shortHour\":\"22\",\"normalCharge\":1,\"minCharge\":0.7,\"buy\":1.4},{\"hour\":\"2025012923\",\"ts\":1738191600000,\"shortHour\":\"23\",\"normalCharge\":2,\"minCharge\":0.3,\"buy\":1.35},{\"hour\":\"2025013022\",\"ts\":1738274400000,\"shortHour\":\"22\",\"normalCharge\":3,\"minCharge\":0.5,\"buy\":1.02}]","payloadType":"json","x":1010,"y":480,"wires":[["5ef1d44eedddfe91"]]},{"id":"5ef1d44eedddfe91","type":"ui-chart","z":"178ed895cc75d9ab","group":"1130e9c196f39867","name":"Plan","label":"Plan","order":2,"chartType":"bar","category":"[\"minCharge\", \"normalCharge\",\"buy\"]","categoryType":"json","xAxisLabel":"","xAxisProperty":"shortHour","xAxisPropertyType":"property","xAxisType":"category","xAxisFormat":"HH","xAxisFormatType":"custom","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"payload","yAxisPropertyType":"msg","ymin":"","ymax":"","bins":10,"action":"replace","stackSeries":false,"pointShape":"false","pointRadius":4,"showLegend":true,"removeOlder":"24","removeOlderUnit":"3600","removeOlderPoints":"33","colors":["#ffd172","#385fff","#cc4c3d","#2ca02c","#a347e1","#d62728","#ff9896","#9467bd","#c5b0d5"],"textColor":["#666666"],"textColorDefault":true,"gridColor":["#e5e5e5"],"gridColorDefault":true,"width":"6","height":"4","className":"","interpolation":"linear","x":1230,"y":480,"wires":[[]]},{"id":"1130e9c196f39867","type":"ui-group","name":"Plan","page":"ce0fb242887e2cfe","width":"6","height":"1","order":2,"showTitle":false,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"ce0fb242887e2cfe","type":"ui-page","name":"Bil","ui":"391b382dc05b69b2","path":"/car","icon":"car","layout":"grid","theme":"c20a7e20a4e37ad0","breakpoints":[{"name":"Default","px":"0","cols":"6"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":3,"className":"","visible":true,"disabled":false},{"id":"391b382dc05b69b2","type":"ui-base","name":"Dashboard2","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":false,"notificationDisplayTime":"5","showDisconnectNotification":false},{"id":"c20a7e20a4e37ad0","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"6px","groupGap":"6px","groupBorderRadius":"4px","widgetGap":"6px","density":"default"}}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 February 2025 11:01 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/8 "2025-02-23T11:01:13Z")

</div>

I think you need to adjust the data so that the x axis key `shortHour` is unique, otherwise the chart just shows whichever value appears last in the array for each key.

For example, changing it to "22a" and "22b" gives this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1526a0a5c9fc04f3578a9def34e7d109c7c4a76.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 February 2025 11:03 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/9 "2025-02-23T11:03:11Z")

</div>

You could include the day or date in the category.

---

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [23 February 2025 11:45 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/10 "2025-02-23T11:45:51Z")

</div>

Thanks guys. I know about the possibility to add more to the label.

I am trying to port from Dashboard 1 to Dashboard 2, and am looking for a way to repeat the labels, instead of adding to them 🙂

But perhaps this specific details is just impossible to port to D2?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 February 2025 14:40 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/11 "2025-02-23T14:40:09Z")

</div>

> [@dth](#):
>
> But perhaps this specific details is just impossible to port to D2

If D1 bar chart did allow repeated categories then you could submit a feature request, pointing out that this is for compatibility with D1, but I suspect that it is likely to be a low priority as I know the developers are snowed under with work. If, however, you were able to submit a Pull Request to implement it (after checking that it would be accepted) then that could solve your problem.

If you did submit a feature request then I suggest you include the flow you posted showing the problem, and a D1 flow showing how D1 supported the feature.

---

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [14 March 2025 15:24 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/12 "2025-03-14T15:24:12Z")

</div>

Thanks guys. It seems this is entirely impossible for a line chart. As far as I can see it requires numbers only on the X-axis, and thus duplicates - even by adding a prefix as a workaround - do not work.

Is there any way to make this line chart in D2?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 March 2025 16:44 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/13 "2025-03-14T16:44:32Z")

</div>

> [@dth](#):
>
> It seems this is entirely impossible for a line chart

I thought it was a bar chart that was the problem, and that it was achievable in a line chart by passing in milliseconds and formatting to show just the hours. The last example you posted was a bar chart.

---

<div class="post-metadata">

**Author:** ![dth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dth/32/72723_2.png) [@dth](https://discourse.nodered.org/u/dth)\
**Post date:** [16 March 2025 07:08 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/14 "2025-03-16T07:08:00Z")

</div>

Thanks.

I'm actually trying to use both like this - bars and lines - for different purposes.

I tried doing the timestamp formatting trick, but couldn't get it to work. Before trying any more, I am considering using Chart.js directly instead.

Would be great if this worked in a simple way, out of the box, though 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 April 2025 07:08 UTC](https://discourse.nodered.org/t/dashboard2-duplicate-values-on-x-axis/95588/15 "2025-04-15T07:08:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
