Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add payload examples for Bar Chart #364

Merged
merged 1 commit into from
Nov 22, 2023
Merged

Docs: Add payload examples for Bar Chart #364

merged 1 commit into from
Nov 22, 2023

Conversation

joepavitt
Copy link
Collaborator

Description

Adds documented examples of payloads to send to a bar chart

Closes #355

@joepavitt joepavitt changed the title Add payload examples for Bar Chart Docs: Add payload examples for Bar Chart Nov 22, 2023
@joepavitt joepavitt merged commit ef2f64b into main Nov 22, 2023
@joepavitt joepavitt deleted the docs-bar-chart branch November 22, 2023 14:04
@colin-grierson
Copy link

Joe, many thanks for your quick response.
Alas, maybe I don't yet have the background knowledge, or am too old school but I can't get it to work.
I want to output the graph in one message (I can make it work with multiple messages)
My payload is structured as in your example (I think):
msg : Object
object
payload: array[10]
0: object
category: "SASMAR"
value: 94351308
1: object
category: "SASOWNER"
value: 54322300
2: object
3: object
4: object
5: object
6: object
7: object
8: object
9: object
category: "SASLJ"
value: 1197152
_msgid: "7631345d0d5c80a5"
In the chart node I have type: Bar. What should I set the Properties Series and Y to?
I have tried quite a number... my best result is with Series: msg. = key:category and Y: key: = value
This results in two bars. The first blank, the second for SASLJ and 1197152 - my last data element.
How do I make this work?

In the documentation you talk about setting the property 'Series', and give example data, but do not say how 'Y' is set. I think it would be much easier to follow if we had: Series, Y, data, Result for the various representative cases.

Thanks again, Colin

@joepavitt
Copy link
Collaborator Author

Series: msg. = key:category and Y: key: = value

I would have expected this to work. I will investigate.

@joepavitt
Copy link
Collaborator Author

Can I check which version of Dashboard you're using? Just tried this with the following dataset:

[
    {
        "category": "SASMAR",
        "value": 94351308
    },
    {
        "category": "SASOWNER",
        "value": 54322300
    },
    {
        "category": "SASLJ",
        "value": 1197152
    }
]

and with the following chart config:

Screenshot 2023-11-23 at 08 54 06

and it rendered:

Screenshot 2023-11-23 at 08 54 20

@joepavitt
Copy link
Collaborator Author

I have also just updated the documentation further to be more explicit about the options available.

@colin-grierson
Copy link

Node-RED version: v3.1.0
Node.js version: v18.17.1
flowfuse/node-red-dashboard 0.7.2
Found it - imagine a shameface icon..
Series msg.key:category
image
Series key:category
image

Sigh, thanks again for your help

@colin-grierson
Copy link

Comment/nice to have...
When we are adding a set of data points to a chart, as in my Top 10 Users example, we most likely want to replace the existing chart than add to it. Of course this can be done by sending a separate message containing a null array, but this is a minor hassle - and easy to miss if most of the time the series are the same and only the values change.
It would be nice to have an option on the chart - maybe 'Clear existing data?' Y/N

@joepavitt
Copy link
Collaborator Author

It would be nice to have an option on the chart - maybe 'Clear existing data?' Y/N

You're not alone in your request: #358

@joepavitt
Copy link
Collaborator Author

Found it - imagine a shameface icon..

Maybe I can include more screenshots of configurations in the docs to make this clearer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation for chart bar graph
2 participants