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

How to pass data to vizzu-story #3

Open
simzer opened this issue Mar 2, 2023 · 1 comment
Open

How to pass data to vizzu-story #3

simzer opened this issue Mar 2, 2023 · 1 comment

Comments

@simzer
Copy link
Member

simzer commented Mar 2, 2023

Instead of hard-coding the data in the py-script elements`s inner text like here:
https://github.com/vizzuhq/pyscript-vizzu-story/blob/main/index.html

How could the user pass the data from a python variable? E.g.:

<py-script>
myData = {
		"series": [
		  { "name": "Foo", "values": ["Alice", "Bob", "Ted"] },
		  { "name": "Bar", "values": [15, 32, 12] },
		  { "name": "Baz", "values": [5, 3, 2] }
		]
	}
</py-script>
<py-vizzu-story>
        {
            "data": myData,
            "slides": [
              {
                "config": {
                  "x": "Foo",
                  "y": "Bar"
                }
              },
              {
                "config": {
                  "color": "Foo",
                  "x": "Baz", 
                  "geometry": "circle" 
                }
              }
            ]
        }
</py-vizzu-story>

It would probably be a frequent use-case to get the data from a csv file or a pandas dataframe, etc...

@simzer
Copy link
Member Author

simzer commented Mar 2, 2023

or:

<py-script>
myData = { ... }
</py-script>
<py-vizzu-story data="myData">
              {
                "config": {
                  "x": "Foo",
                  "y": "Bar"
                }
              },
              {
                "config": {
                  "color": "Foo",
                  "x": "Baz", 
                  "geometry": "circle" 
                }
              }
</py-vizzu-story>

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

No branches or pull requests

1 participant