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

Implement method for Plot type to return traces_with_type_json and layout_json strings #179

Open
2 tasks
ArtemkaKun opened this issue Oct 21, 2023 · 0 comments
Assignees

Comments

@ArtemkaKun
Copy link
Contributor

Describe the feature

Currently, to show plot on a webpage, plot calculated JSON strings with meta/data of plot and inserts this data into HTML, which then will be shown to the user.

We need to make this process more flexible to allow users to calculate JSON data for plot separately from the whole show() logic.

Use Case

To embed plot into an already existent web page or use it wherever else.

Proposed Solution

Currently, as an experiment, I just modified plotly() method, made it public, and made it only return needed strings instead of the HTML code of the whole page.

pub fn (plot Plot) plotly() (string, string) {
	traces_with_type := plot.traces.map({
		'type':  TracesWithTypeValue(it.trace_type())
		'trace': TracesWithTypeValue(it)
	})
	traces_with_type_json := encode(traces_with_type)
	layout_json := encode(plot.layout)

	return layout_json, traces_with_type_json
      
    
}

This should be done in a smarter and better way

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

6904d72

Environment details (OS name and version, etc.)

Not related

@ulises-jeremias ulises-jeremias self-assigned this Oct 21, 2023
@ulises-jeremias ulises-jeremias linked a pull request Oct 21, 2023 that will close this issue
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

2 participants