Hello, Mike and all!
I have reached a minimally usable state in my chart vocab. Granted, at the moment if you want to change the axis scale you have to recompile the gadget, but still, at least the scaling is implemented.
See code sample in the comment at the bottom of the charts.factor.
chart-dim should return the current { width height } of the chart gadget, in pixels. This needs to be replaced with getting the actual size of the gadget. Then if you put the chart gadget into a resizable window, you could scale it dynamically. How can we do that?
chart-axes returns { { xmin xmax } { ymin ymax } }, which controls which part of the chart you want to display in the { width height } dimensions of the chart gadget.
The only type of series currently supported is one that's given as a set of points with straight line connections between the points. The points must be sorted by non-descending x coordinate. I strived for an optimized implementation, so that it would work fast on large data sets. That's why the first thing it does is cutting away all the data points outside the current view, and then it proceeds to draw the lines using the minimal number of opengl calls. There is one more optimization that I have in mind, but it can wait (basically, the idea is when you zoom out too far, x axis starts having clusters of data points that require sub-pixel resolution to display. Those clusters should be compressed into min-max pairs to avoid drawing over the same bunch of pixels for a long time with no visible effect).
If you, or anyone else here, wants to audit the code, make suggestions or contribute ideas or code, you are more than welcome!
I think there is a lot to be done in the area of interactivity. Dragging the chart axes with mouse, zooming in and out - all that would be awesome. Export to png and other formats, if possible, would also be great. Somehow we need to draw the axes, which is a non-trivial task in itself. All of these areas I have virtually no experience in, so I'd love to hear from you.
18.01.2017, 23:05, "Mike Maul" <mike.m...@gmail.com>:
That is really really nice. I love the declarative style for chart composition. Where is you're repo love to check it out.On Jan 13, 2017 5:42 AM, "Alexander Ilin" <ajs...@yandex.ru> wrote:Hello, Mike!10.12.2016, 06:05, "Mike Maul" <mike.m...@gmail.com>:What would be really awesome is a graphing factor ui element.I have some work in progress that I'd like to contribute to Factor codebase as soon as it's minimally usable.I'm implementing simple line charts in a GUI gadget. Here's how I start the test code:USING: charts charts.lines ;chart new line new COLOR: blue >>color { { 0 100 } { 100 0 } { 100 50 } { 150 50 } { 200 100 } } >>data add-gadget gadget.
---=====---
Александр
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk