usethesource / rascal

The implementation of the Rascal meta-programming language (including interpreter, type checker, parser generator, compiler and JVM based run-time system)
http://www.rascal-mpl.org
Other
408 stars 77 forks source link

`vis::Charts` feature requests #1720

Open jurgenvinju opened 2 years ago

jurgenvinju commented 2 years ago

all via @DavyLandman , but if there is more please add to this.

olijf commented 1 year ago

afbeelding I managed to get a pie chart using the chartServer and the pie chart:

serve(|http://localhost:30000|, chartServer(chartData(toRel(mapWithData)), \type=\pie(), title="Pie Chart", colorMode=\data()), asDaemon = false);

olijf commented 1 year ago

How would I rewrite this to have multiple types of diagrams on the same page?

jurgenvinju commented 1 year ago

Well you could change the html to have multiple div's and multiple fetch calls, and then change the server code to handle the different fetch http requests. Every fetch has a different url path. Every reply handler matches that path. The rest is css voodoo

jurgenvinju commented 1 year ago

So mostly you can develop the client side as if you're purely programming js or ts and html/css, and you write a server in Rascal to provide the data directly and to respond to interaction like clicks on file locations.

jurgenvinju commented 1 year ago

You could even write the html in an html file. It's not necessary to write an html AST. I did that to keep the co-evolving parts of the server and the client in one file.

olijf commented 1 year ago

Would it be too much to ask for an example with the separate client side? I saw in one of the unittest something to read an HTML file and then serve that, but nothing were part of the file is build up dynamically using data.

jurgenvinju commented 1 year ago

I would keep with the basic structure of Charts.rsc and just change that step-by-step to your liking. You can read HTML files with lang::html::IO and copy/paste the HTML syntax trees into your code if you want to learn from existing HTML examples. I'm not working on the weekend, so good luck 😁

olijf commented 1 year ago

would it be nice to also have d3js in there somewhere so we can choose what charts we want?