randyzwitch / ECharts.jl

Julia package for the Apache ECharts v4 visualization library
https://randyzwitch.com/ECharts.jl/
Other
84 stars 9 forks source link

Add chart types #58

Open randyzwitch opened 6 years ago

randyzwitch commented 6 years ago

Completed:

To do:

braamvandyk commented 4 years ago

Is there some documentation to get up to speed with this? I would be happy to add a few of these, if I can.

randyzwitch commented 4 years ago

Thanks for checking out ECharts! I haven't written any contributing docs yet, so I should probably do that. But in general, I've taken a very different approach than most other plotting packages in Julia.

First, I have intentionally not implemented the plot recipes style, because I find it confusing and also switching backends isn't interesting to me. Secondly, my API style is much more opinionated about what the minimum number of arguments for any can be and what the default arguments should be. You'll notice that for each function, the minimum arguments are just the data arguments; stylistic arguments are keywords with defaults. Finally, my style is to view visualizations as iterations, where you're applying operations to the chart. That's why all the style functions have the exclamation point; they take a pre-existing chart and modify it somehow.

If there's a specific chart you are interested in first, I'd be happy to work with you to get it implemented, so that you can get the feel of this library. The way I started was to get the working JSON from the echarts website, then work to generate that same JSON using Julia structs. You can either render the chart to see if it gives you what you want or call print(x::EChart) and the JSON will be printed to the console.

braamvandyk commented 4 years ago

Thanks. How about starting with graphs? It's not on the list, but it's what I was looking for when I found ECharts in the first place.

randyzwitch commented 4 years ago

Graphs like these? https://echarts.baidu.com/examples/editor.html?c=graph-force

Regardless of where you start, I think the area.jl shows the style I've gone for:

https://github.com/randyzwitch/ECharts.jl/blob/master/src/plots/area.jl

Here, you'll see that I define methods for arrays first, then dataframes (which can be thought of as lists of lists), then the KernelDensity.UnivariateKDE function signature. What I've found is that multiple dispatch tends to make it really easy to work this way; defining your methods in terms of a Julia standard type, then decomposing the compound types fields into calling the same method with the Julia standard types.

Ultimately, I'm not going to be a stickler at this point about how you implement this, because more chart types is better than arguing about syntax! When you get even a rough draft going, open a PR and I'll take a look

braamvandyk commented 4 years ago

Right, well let me see what I can manage. Will get back with either a result or a cry for help ASAP.