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

Graph Widget? Plot Widget? #264

Closed
ccoupe opened this Issue Jul 26, 2016 · 85 comments

Comments

Projects
None yet
4 participants
@ccoupe
Contributor

ccoupe commented Jul 26, 2016

Does anyone need a challenge ( @passenger94 ?). Long ago I did some some time series analysis foolery in Java and wrote a "widget" that would graph multiple time series data, auto scale the content to the window size, zoom in/out and move the zoomed graph left or right.

Hard core data analysis folks would just call out to gnuplot but gnuplot is huge and not really something we want to include in Shoes. Still, some cross platform visualization capability might be useful. I imagine, without thinking much on my part, that It would be Shoes widget (canvas) and we'd use mostly Cairo to draw and C/Ruby to get values out of Ruby arrays. Could it be done with pure Shoes/Ruby? Probably. Performance? I don't know - the test data sets I have are 5K of observations and they drew surprisingly quick on a Windows 98 laptop in Java 1.02,

@ccoupe ccoupe added the Enhancement label Jul 26, 2016

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 26, 2016

Contributor

Wow! That old Java code still works and just as painful to setup. Screen shot of graphing ^SPX (S&P 500) and ^IRX.R (3 month US Treasury Bill rate). The question is how to do it in Shoes and not what the plot tells you.
graph-example

Contributor

ccoupe commented Jul 26, 2016

Wow! That old Java code still works and just as painful to setup. Screen shot of graphing ^SPX (S&P 500) and ^IRX.R (3 month US Treasury Bill rate). The question is how to do it in Shoes and not what the plot tells you.
graph-example

@ccoupe

This comment has been minimized.

Show comment
Hide comment
Contributor

ccoupe commented Jul 26, 2016

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 26, 2016

Contributor

foolery in Java

sounds like a pleonasm :-D

haha, thanks for challenge :-), will look at it, if only for curiosity, i was interested in this when looking at the profiler thing and ways to get visual feedback
lack of time lately, some opportunities maybe next month

Contributor

passenger94 commented Jul 26, 2016

foolery in Java

sounds like a pleonasm :-D

haha, thanks for challenge :-), will look at it, if only for curiosity, i was interested in this when looking at the profiler thing and ways to get visual feedback
lack of time lately, some opportunities maybe next month

@dredknight

This comment has been minimized.

Show comment
Hide comment
@dredknight

dredknight Jul 27, 2016

Contributor

this looks really awesome!
I have to get together and finish that popup thing and I can hop over and check this too :)

Contributor

dredknight commented Jul 27, 2016

this looks really awesome!
I have to get together and finish that popup thing and I can hop over and check this too :)

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 5, 2016

Contributor

Still thinking out loud about this. It should be easy enough to convert that java code into a shoes.widget in pure ruby. Looking at the java, the DataSeries class is actually the bigger problem because I know it's sordid secrets - it has no way to represent 'no data' or 'bad data' for 'this observation' and it assumes all DataSeries have the same date/time starting point and ending point and number of observations. In order to be part of Shoes, the drawing code has to be in lib/shoes/ and while there are reasons to have DataSeries be a Gem, there are good (Loose Shoes symlink) reasons to put it into lib/shoes/DataSeries/

I've uploaded some Stock Market data files (csv format) to here - the contents are obvious. There is a long ago, mostly useless reason they start with '^' but it's what I have.

I've created branch 'graph' which is where this experiment should live.

Contributor

ccoupe commented Aug 5, 2016

Still thinking out loud about this. It should be easy enough to convert that java code into a shoes.widget in pure ruby. Looking at the java, the DataSeries class is actually the bigger problem because I know it's sordid secrets - it has no way to represent 'no data' or 'bad data' for 'this observation' and it assumes all DataSeries have the same date/time starting point and ending point and number of observations. In order to be part of Shoes, the drawing code has to be in lib/shoes/ and while there are reasons to have DataSeries be a Gem, there are good (Loose Shoes symlink) reasons to put it into lib/shoes/DataSeries/

I've uploaded some Stock Market data files (csv format) to here - the contents are obvious. There is a long ago, mostly useless reason they start with '^' but it's what I have.

I've created branch 'graph' which is where this experiment should live.

@ccoupe ccoupe added this to the 3.3.3 milestone Aug 5, 2016

ccoupe added a commit that referenced this issue Aug 5, 2016

start on #264. Abstract DataSeries.
* csv.rb is the test program. `ruby csv.rb` works - it's
  not Shoes yet.
* Do you wonder about huge hashes and arrays? Me too.

ccoupe added a commit that referenced this issue Aug 5, 2016

for #264 - move code from csv.rb to dataseries.rb
*  still not correct or pretty,

ccoupe added a commit that referenced this issue Aug 8, 2016

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 8, 2016

Contributor

Pure Shoes/ruby - test of concept. It works. Of course it's missing all kinds of things.
pure_ruby_graph

Good enough to try sub classing Shoes.widget.

Contributor

ccoupe commented Aug 8, 2016

Pure Shoes/ruby - test of concept. It works. Of course it's missing all kinds of things.
pure_ruby_graph

Good enough to try sub classing Shoes.widget.

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Aug 8, 2016

Contributor

i say YES !!!
👠 👠 👠 🔆

Contributor

passenger94 commented Aug 8, 2016

i say YES !!!
👠 👠 👠 🔆

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 9, 2016

Contributor

So it's now a Shoes::Widget and it's time to add the axes and labels. OOPS! Shoes doesn't have methods for drawing text at x,y. Time to move c/obj-c? Maybe Shoes should have an Art Shape (like oval, star, etc ) named Art_String ??? so art_string {x:, y:, font:, fontsize:,color:, length: , text:}. I don't know how hard that is to do but it has some appeal and might be useful for other folks for other applications. Probably easier to do than creating a new c/obj-c graph widget so I like that. It might be useful text on top a image (with transforms already available like rotate and skew). Opinions?

Contributor

ccoupe commented Aug 9, 2016

So it's now a Shoes::Widget and it's time to add the axes and labels. OOPS! Shoes doesn't have methods for drawing text at x,y. Time to move c/obj-c? Maybe Shoes should have an Art Shape (like oval, star, etc ) named Art_String ??? so art_string {x:, y:, font:, fontsize:,color:, length: , text:}. I don't know how hard that is to do but it has some appeal and might be useful for other folks for other applications. Probably easier to do than creating a new c/obj-c graph widget so I like that. It might be useful text on top a image (with transforms already available like rotate and skew). Opinions?

ccoupe added a commit that referenced this issue Aug 9, 2016

on #264, widgetize.
on #264, widgetize.
on #264, widgetize.
on #264, widgetize.
on #264, widgetize.
on #264, widgetize.

ccoupe added a commit that referenced this issue Aug 9, 2016

@ccoupe ccoupe referenced this issue Aug 9, 2016

Open

text_shape? #266

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 11, 2016

Contributor

Considering that I'm just converting my java code, it would be conceptually easier to create a widget,
similar to svg which I understand a lot better than Shape manipulation code (#266). It would have better performance for large data sets but not nearly as flexible for future enhancements. It's possible to do both a native widget and a Shoes::Widget version.

I think I'll call the native widget 'plot' unless someone has a better name. API is pretty simplistic so far:
pl = plot width, height. {options} and pl.add {options} | dataseries and pl.redraw in case someone is appending real time data. The option names: and defaults to be determined later but :data => [array of floatables]`, :name => "string", :minv => float, :maxv => float are the minimum.

Contributor

ccoupe commented Aug 11, 2016

Considering that I'm just converting my java code, it would be conceptually easier to create a widget,
similar to svg which I understand a lot better than Shape manipulation code (#266). It would have better performance for large data sets but not nearly as flexible for future enhancements. It's possible to do both a native widget and a Shoes::Widget version.

I think I'll call the native widget 'plot' unless someone has a better name. API is pretty simplistic so far:
pl = plot width, height. {options} and pl.add {options} | dataseries and pl.redraw in case someone is appending real time data. The option names: and defaults to be determined later but :data => [array of floatables]`, :name => "string", :minv => float, :maxv => float are the minimum.

ccoupe added a commit that referenced this issue Aug 12, 2016

minimal plog widget #264
* compiles (loose linux)
* doesn't work - plot.c (shoes_plot_add) doesn't detect TimeSeries class
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 13, 2016

Contributor

API alert - some options belong to plot or chart (title and caption, width and height) and some belong to the data (like name, display_name, values and many more); The plot/chart behaves differently depending on how many arrays it's supposed to display. So, it's a two step creation process in Shoes plot width, height, {options) and plot.add {many_hash_args}

Contributor

ccoupe commented Aug 13, 2016

API alert - some options belong to plot or chart (title and caption, width and height) and some belong to the data (like name, display_name, values and many more); The plot/chart behaves differently depending on how many arrays it's supposed to display. So, it's a two step creation process in Shoes plot width, height, {options) and plot.add {many_hash_args}

ccoupe added a commit that referenced this issue Aug 15, 2016

for #264 - remove Timeseries and Dataseries from Shoes
* too domain specific for Shoes.
  and ca

ccoupe added a commit that referenced this issue Aug 15, 2016

for #264 - native plot widget. compiles on loose Shoes Linux.
* remove dataseries and Timeseries -- too domain specific to be
  part pf Shoes. Useful to get the API correct - plot (widget) vs
  dots on screen.
* Very sure I don't understand cairo transforsm.
  This just place keeper/backup commit

ccoupe added a commit that referenced this issue Aug 16, 2016

for #264 - can draw tile and caption strinf
* SO MANY TODO
* doesn't draw the data.
* appears to get the cairo transform correct but who knows?
* could it be better? Hell Yes. I have no idea what I'm doing.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 18, 2016

Contributor

[Updated 2016-08-19]
better_plot

Contributor

ccoupe commented Aug 18, 2016

[Updated 2016-08-19]
better_plot

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 22, 2016

Contributor

Getting better. So many things to do under the covers.
better-plot

The potential api keeps expanding with all the options the users might like ( turning of the grid lines for example)

Contributor

ccoupe commented Aug 22, 2016

Getting better. So many things to do under the covers.
better-plot

The potential api keeps expanding with all the options the users might like ( turning of the grid lines for example)

ccoupe added a commit that referenced this issue Aug 22, 2016

ccoupe added a commit that referenced this issue Aug 22, 2016

ccoupe added a commit that referenced this issue Aug 22, 2016

issue #264 - add second data series in test (graph.rb)
* many things to do. Doesn't trigger refresh.
  does not draw left side y axis values
  probably does not handle float values
  may not not handle negative values.

ccoupe added a commit that referenced this issue Aug 23, 2016

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 25, 2016

Contributor

The plot widget is almost good_enough for people to try it and find out what doesn't work for them. It does work on all platforms. I might think about including it in 3.3.2. Even if its a little half baked. Documenting it is going to be a challenge.
good-enough

and the script to create that:

# good-graph.rb
Shoes.app width: 620, height: 610 do
  @values1 = [24, 22, 10, 13, 20, 8, 22]
  @x_axis1 = ['a','b','c','d','e','f', 'g']
  @values2 = [200, 150, 75, 125, 75, 50, 125]
  stack do
    para "Plot Widget Demo"
    flow do 
      button "quit" do Shoes.quit end
    end
    widget_width = 600
    widget_height = 400
    @grf = plot widget_width, widget_height, title:"My Graph", caption: 
      "Look at that! Booyah!!" , font: "Helvetica", auto_grid: true
    @grf.add num_obs: @values1.size, values: @values1, xobs: @x_axis1,
       name: "foobar", minv: 6, maxv: 26 , long_name: "foobar Yy"
    button "add #2" do
      @grf.add num_obs: @values2.size, values: @values2,
        name: "bartab", minv: @values2.min, maxv: @values2.max
    end
  end
end
Contributor

ccoupe commented Aug 25, 2016

The plot widget is almost good_enough for people to try it and find out what doesn't work for them. It does work on all platforms. I might think about including it in 3.3.2. Even if its a little half baked. Documenting it is going to be a challenge.
good-enough

and the script to create that:

# good-graph.rb
Shoes.app width: 620, height: 610 do
  @values1 = [24, 22, 10, 13, 20, 8, 22]
  @x_axis1 = ['a','b','c','d','e','f', 'g']
  @values2 = [200, 150, 75, 125, 75, 50, 125]
  stack do
    para "Plot Widget Demo"
    flow do 
      button "quit" do Shoes.quit end
    end
    widget_width = 600
    widget_height = 400
    @grf = plot widget_width, widget_height, title:"My Graph", caption: 
      "Look at that! Booyah!!" , font: "Helvetica", auto_grid: true
    @grf.add num_obs: @values1.size, values: @values1, xobs: @x_axis1,
       name: "foobar", minv: 6, maxv: 26 , long_name: "foobar Yy"
    button "add #2" do
      @grf.add num_obs: @values2.size, values: @values2,
        name: "bartab", minv: @values2.min, maxv: @values2.max
    end
  end
end

ccoupe added a commit that referenced this issue Aug 25, 2016

ccoupe added a commit that referenced this issue Aug 25, 2016

for #264 - new plot api options to specify the number of
* x-axis and y-axis grid line (if auto_grid: true) to draw.
* "plenty of rope"

ccoupe added a commit that referenced this issue Aug 29, 2016

more #264 fun. Changed some Shoes facing method name
* can handle missing (nil) data points. More needs to be done in parsing
  the options for that in new()
* removed the java comments - all done.
* usuable as is. Shoes quality? Even though I can do more?

ccoupe added a commit that referenced this issue Aug 30, 2016

on #264 - a beta beta release.
* https://github.com/Shoes3/shoes3/wiki/Plot-Widget
* needs special sauce to trigger a redraw, Usual methods don't

ccoupe added a commit that referenced this issue Sep 1, 2016

on #264, color option for data serices overrides built in choices
* uses Shoes color names and values.
* something isn't setup correctly in canvas.[ch] and ruby.[ch]
  for click and release.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Sep 2, 2016

Contributor
Contributor

ccoupe commented Sep 2, 2016

ccoupe added a commit that referenced this issue Sep 3, 2016

for #264 - basic drawing might be complete.
* working on rendering in to ps/pdf/svg/png/clipboard

ccoupe added a commit that referenced this issue Sep 4, 2016

for #264 - can save plot as png,pdf,svg,ps
* looks good in vector - no jaggy lines and pdf is smaller that
  png.

ccoupe added a commit that referenced this issue Sep 4, 2016

for #264, a test program that zooms in and out
* reguires my funky csv files.
* plenty fast for large files and draws.
@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Sep 6, 2016

Contributor

synched and expert-graph.rb works fine on my system 👍
also found graph.rb and getest.rb, didn't yet got what it does exactly.
Is there a cvs test file somewhere ?

Contributor

passenger94 commented Sep 6, 2016

synched and expert-graph.rb works fine on my system 👍
also found graph.rb and getest.rb, didn't yet got what it does exactly.
Is there a cvs test file somewhere ?

ccoupe added a commit that referenced this issue Oct 18, 2016

for #264 - create chart_series internally
* when a hash is given to plot.add - moves arg parse to chart_series_new
* update each Test to use both a hash and an explicit chart_series

ccoupe added a commit that referenced this issue Oct 19, 2016

issues #270, #264 move chart_series and svghandle methods
* into canvas (Shoes) space, app.svghandle {} still works
  so old code does work.
* modified Test/plots/ scripts
* grcsv.rb test does not work.

ccoupe added a commit that referenced this issue Oct 20, 2016

on #264, fixes defaults colors (grcsv enabled bug)
* allows setting defaults for series color with plot colors: []
* see Tests/plot/gr5.rb
* affects and chart_series that default it's color. As it should.
@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 21, 2016

Collaborator

By the way, why is it called chart_series instead of just simply chart? Simplicity is always key but you may have good reasons for the name.

Collaborator

BackOrder commented Oct 21, 2016

By the way, why is it called chart_series instead of just simply chart? Simplicity is always key but you may have good reasons for the name.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 22, 2016

Contributor

Although plot_series or plot_data or something like that is a more logical name. My hope is somebody will step forward and write a graph library /gem in Shoes/Ruby (assuming #266) and they'll probably name it Chart or Graph. If they have lots of data residing in files or sql db query results, instead of re-typing values and labels into their Shoes script, then they need an Object of some_name to hold that data and it should be usable in both the built in Shoes and their shiny new library or gem or script. Psuedo code:

class DataSeries << chart_series do
  require 'sqlitite'
  def initialize (sqlquery_string)
    ....
   super(values, labels, min, max...)
  # add my special things
  end
end

That object could be used by both the Built in Shoes plot types and anything the (future) #266 user creates.

I'll note that most of the world have never seen or programmed a mechanical plotter and debugged a FORTRAN/C/driver and the users program. Life is much better now days. Much better. Hell, you can drive a 3D printer with $35 Raspberry PI and and never know about C variable names used in the library.

Contributor

ccoupe commented Oct 22, 2016

Although plot_series or plot_data or something like that is a more logical name. My hope is somebody will step forward and write a graph library /gem in Shoes/Ruby (assuming #266) and they'll probably name it Chart or Graph. If they have lots of data residing in files or sql db query results, instead of re-typing values and labels into their Shoes script, then they need an Object of some_name to hold that data and it should be usable in both the built in Shoes and their shiny new library or gem or script. Psuedo code:

class DataSeries << chart_series do
  require 'sqlitite'
  def initialize (sqlquery_string)
    ....
   super(values, labels, min, max...)
  # add my special things
  end
end

That object could be used by both the Built in Shoes plot types and anything the (future) #266 user creates.

I'll note that most of the world have never seen or programmed a mechanical plotter and debugged a FORTRAN/C/driver and the users program. Life is much better now days. Much better. Hell, you can drive a 3D printer with $35 Raspberry PI and and never know about C variable names used in the library.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 22, 2016

Collaborator

This is very interesting. I'm liking the thoughtfulness of your approach. It does seem like a wrapper class more than a base class. Your chart_series and plot_series already do the deed. So they should really name their class like SQLiteChart.

Shoes is meant to be intuitive and easy to use. Wouldn't those be arguments to name them chart and plot?

My concern is really Shoes end users. Their programming background may be limited. They use Shoes for convenience and easy to learn and use. Long names, complex names, meaningless names are all kind of things to throw them off their chairs and give up.

Collaborator

BackOrder commented Oct 22, 2016

This is very interesting. I'm liking the thoughtfulness of your approach. It does seem like a wrapper class more than a base class. Your chart_series and plot_series already do the deed. So they should really name their class like SQLiteChart.

Shoes is meant to be intuitive and easy to use. Wouldn't those be arguments to name them chart and plot?

My concern is really Shoes end users. Their programming background may be limited. They use Shoes for convenience and easy to learn and use. Long names, complex names, meaningless names are all kind of things to throw them off their chairs and give up.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 23, 2016

Contributor

Evidence suggests Shoes doesn't have a lot of users or the product is nearly perfect and they have few complaints. People occasionally contact me via email and everyone of them has been pretty knowledgeable. If you're clever enough to figure out sql in ruby (ugly) or contemplating writing your graph library or widget using Shoes shapes then you'll be able to handle chart_series as a name. A decent argument can be made for calling it plot_series but I'm not convinced it's really going to matter.

I do intend to add some methods to the chart_series class. I also want to allow a &blk arg (proc) that will be passed some args: index of the label, and how many characters the current layout will allow. Uses can size down the return string any way that works for them, or just let the labels overlap visually. Not written yet and I suspect no-one will use it when it is written.

The chart_series will be documented in the Advanced section of the manual with just a few mentions in the Elements->plot section.

Remember, one of the goals of Shoes 3.3 was to expand the range of problems Shoes could address for more skilled developers. New terminal/console window (optional ) for old school puts from things like mini_test (not a beginner tool) and the Profiler (not a beginner tool) and better command line support. Merge packaging is for hard core professional developers.

The Simple Shoes Vision no longer exists. I suspect it when _why left the building. Ruby is too complex for something simple. If someone cared about new users and tutorials, they would maintain Hackety Hack. Crickets. Is Shoes easier than pygtk ? Yes. As powerful? No.

Contributor

ccoupe commented Oct 23, 2016

Evidence suggests Shoes doesn't have a lot of users or the product is nearly perfect and they have few complaints. People occasionally contact me via email and everyone of them has been pretty knowledgeable. If you're clever enough to figure out sql in ruby (ugly) or contemplating writing your graph library or widget using Shoes shapes then you'll be able to handle chart_series as a name. A decent argument can be made for calling it plot_series but I'm not convinced it's really going to matter.

I do intend to add some methods to the chart_series class. I also want to allow a &blk arg (proc) that will be passed some args: index of the label, and how many characters the current layout will allow. Uses can size down the return string any way that works for them, or just let the labels overlap visually. Not written yet and I suspect no-one will use it when it is written.

The chart_series will be documented in the Advanced section of the manual with just a few mentions in the Elements->plot section.

Remember, one of the goals of Shoes 3.3 was to expand the range of problems Shoes could address for more skilled developers. New terminal/console window (optional ) for old school puts from things like mini_test (not a beginner tool) and the Profiler (not a beginner tool) and better command line support. Merge packaging is for hard core professional developers.

The Simple Shoes Vision no longer exists. I suspect it when _why left the building. Ruby is too complex for something simple. If someone cared about new users and tutorials, they would maintain Hackety Hack. Crickets. Is Shoes easier than pygtk ? Yes. As powerful? No.

ccoupe added a commit that referenced this issue Oct 23, 2016

for #264 - update the manual.
* This widget is very complicated to describe and there is much
  more to talk about.
@dredknight

This comment has been minimized.

Show comment
Hide comment
@dredknight

dredknight Oct 23, 2016

Contributor

@ccoupe facts are on point. When one is a newbie in coding he does not search for easy tool to do stuff. He just starts with something popular because when you don't know anything you start with what is modern/fashionable.

I love Shoes because of its syntax simplicity which does not make it limited when it comes to building complex stuff.

The more functionality (lineary) it is invested in shoes, the more flexible it becomes (exponentially).

Contributor

dredknight commented Oct 23, 2016

@ccoupe facts are on point. When one is a newbie in coding he does not search for easy tool to do stuff. He just starts with something popular because when you don't know anything you start with what is modern/fashionable.

I love Shoes because of its syntax simplicity which does not make it limited when it comes to building complex stuff.

The more functionality (lineary) it is invested in shoes, the more flexible it becomes (exponentially).

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 23, 2016

Collaborator

@ccoupe It seems that you feel much strongly about the issue than I do. However, I'd like to reply to what you wrote for your consideration.

Evidence suggests Shoes doesn't have a lot of users or the product is nearly perfect and they have few complaints. People occasionally contact me via email and everyone of them has been pretty knowledgeable.

It is true now. It might be true later on. It might or might now always be true. On the other side, keeping the syntax of new features friendly will always leave the door open for newcomers. Also, remember, consistency is important. We are talking about a language where paragraph is shorten to para.

If you're clever enough to figure out sql in ruby (ugly) or contemplating writing your graph library or widget using Shoes shapes then you'll be able to handle chart_series as a name. A decent argument can be made for calling it plot_series but I'm not convinced it's really going to matter.

Ah! You are missing my point. I am talking about the rest who would not use SQL. They would use chart_series or plot_series directly. My understanding is that they draw charts with data provided by the user in a self-sufficient manner.

Hypothetical newbie scenario:

  • Hey, I'd like to draw a pie chart...
  • Let's see what Shoes has for that... chart? Sounds good
  • Alright, where do I enter the title... oh yeah... the labels? right... data? done.
  • Type, type, type... run... wow, it works!

Just like when someone wants to draw a line, circle, svg, etc. The Shoes commands are appropriately corresponding to what someone would one to do. No fancy thing.

I do intend to add some methods to the chart_series class. I also want to allow a &blk arg (proc) that will be passed some args: index of the label, and how many characters the current layout will allow. Uses can size down the return string any way that works for them, or just let the labels overlap visually. Not written yet and I suspect no-one will use it when it is written.

Amazing!

The Simple Shoes Vision no longer exists. I suspect it when _why left the building. Ruby is too complex for something simple. If someone cared about new users and tutorials, they would maintain Hackety Hack. Crickets. Is Shoes easier than pygtk ? Yes. As powerful? No.

Not entirely true but not entirely false. Consistency should however be taken in consideration. We might not be able to redo the whole underneath model as in Shoes4 but we still can keep things in a straightforward manner.

Collaborator

BackOrder commented Oct 23, 2016

@ccoupe It seems that you feel much strongly about the issue than I do. However, I'd like to reply to what you wrote for your consideration.

Evidence suggests Shoes doesn't have a lot of users or the product is nearly perfect and they have few complaints. People occasionally contact me via email and everyone of them has been pretty knowledgeable.

It is true now. It might be true later on. It might or might now always be true. On the other side, keeping the syntax of new features friendly will always leave the door open for newcomers. Also, remember, consistency is important. We are talking about a language where paragraph is shorten to para.

If you're clever enough to figure out sql in ruby (ugly) or contemplating writing your graph library or widget using Shoes shapes then you'll be able to handle chart_series as a name. A decent argument can be made for calling it plot_series but I'm not convinced it's really going to matter.

Ah! You are missing my point. I am talking about the rest who would not use SQL. They would use chart_series or plot_series directly. My understanding is that they draw charts with data provided by the user in a self-sufficient manner.

Hypothetical newbie scenario:

  • Hey, I'd like to draw a pie chart...
  • Let's see what Shoes has for that... chart? Sounds good
  • Alright, where do I enter the title... oh yeah... the labels? right... data? done.
  • Type, type, type... run... wow, it works!

Just like when someone wants to draw a line, circle, svg, etc. The Shoes commands are appropriately corresponding to what someone would one to do. No fancy thing.

I do intend to add some methods to the chart_series class. I also want to allow a &blk arg (proc) that will be passed some args: index of the label, and how many characters the current layout will allow. Uses can size down the return string any way that works for them, or just let the labels overlap visually. Not written yet and I suspect no-one will use it when it is written.

Amazing!

The Simple Shoes Vision no longer exists. I suspect it when _why left the building. Ruby is too complex for something simple. If someone cared about new users and tutorials, they would maintain Hackety Hack. Crickets. Is Shoes easier than pygtk ? Yes. As powerful? No.

Not entirely true but not entirely false. Consistency should however be taken in consideration. We might not be able to redo the whole underneath model as in Shoes4 but we still can keep things in a straightforward manner.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 24, 2016

Contributor

As we often do, we seem to be talking past each other until we figure it out. Remember that chart creation is a two step process - create the widget (chart type) and then add data/labels to it. For line, bar, and timeseries, you can add multiple collections of 'Thing X' to the chart. Thing X also contains important things like the color you want and the min/max used to scale that part of the chart.

I really don't care what the Shoes object is named, I think it needs to exist and it does exist because the C was getting unmanageable and that wouldn't get better for new chart types or future enhancements to Thing X. From Tests/plot/gr3.rb

    @grf2.add values: @values1, labels: @x_axis1,
       name: "Bar", min: 0, max:  30, desc: "foobar Yy", color: "crimson",
       points: true, strokewidth: 12
    cs2 = chart_series values: @values2, labels: @x_axis2,
       name: "Tab", min: 50, max: 230, desc: "BarTab", color: "green",
       points: true, strokewidth: 6
    @grf2.add cs2

Both @grf.add 'hash' and 'chart_series' work. User's preference. The 'hash' version just creates the chart_series for you behind the scenes. Which one is the simplest? Minor differences, IMO and we have both, and always will. . Which one can be sub classed and re-purposed for other duty should someone who is not newbie prefer? - hash args in a Ruby program they cant change by a running script or an object they can build on?

Currently Thing X is called 'chart_series' at the C and Ruby levels. In my wandering around the interwebs I haven't found a common name for what Thing X is. I also haven't seen many FOSS Windows or OSX programs that draws simple charts, simply. Niche? I do care about doing the best thing given the situation we find ourselves in. We all do. Actually I prefer data_series and shoes_plot_data_series but that feels presumptive and invites a name clash with some ruby gem somewhere.

Contributor

ccoupe commented Oct 24, 2016

As we often do, we seem to be talking past each other until we figure it out. Remember that chart creation is a two step process - create the widget (chart type) and then add data/labels to it. For line, bar, and timeseries, you can add multiple collections of 'Thing X' to the chart. Thing X also contains important things like the color you want and the min/max used to scale that part of the chart.

I really don't care what the Shoes object is named, I think it needs to exist and it does exist because the C was getting unmanageable and that wouldn't get better for new chart types or future enhancements to Thing X. From Tests/plot/gr3.rb

    @grf2.add values: @values1, labels: @x_axis1,
       name: "Bar", min: 0, max:  30, desc: "foobar Yy", color: "crimson",
       points: true, strokewidth: 12
    cs2 = chart_series values: @values2, labels: @x_axis2,
       name: "Tab", min: 50, max: 230, desc: "BarTab", color: "green",
       points: true, strokewidth: 6
    @grf2.add cs2

Both @grf.add 'hash' and 'chart_series' work. User's preference. The 'hash' version just creates the chart_series for you behind the scenes. Which one is the simplest? Minor differences, IMO and we have both, and always will. . Which one can be sub classed and re-purposed for other duty should someone who is not newbie prefer? - hash args in a Ruby program they cant change by a running script or an object they can build on?

Currently Thing X is called 'chart_series' at the C and Ruby levels. In my wandering around the interwebs I haven't found a common name for what Thing X is. I also haven't seen many FOSS Windows or OSX programs that draws simple charts, simply. Niche? I do care about doing the best thing given the situation we find ourselves in. We all do. Actually I prefer data_series and shoes_plot_data_series but that feels presumptive and invites a name clash with some ruby gem somewhere.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 25, 2016

Collaborator

@ccoupe thanks for explaining. Hash is simpler. ;)

By the way, does color: supports rgb() values? It should be noted that other Shoes methods support Shoes colornames, such as background, which does not use quotes as in Test/plot/gr3.rb. Consistency is important.

Hopefully you understand that I am not nitpicking. The chart feature is absolutely fantastic. I remember wanting to get some Java charting in the past but the only decent packages were available for sales. So it's refreshing to get it for Shoes.

Collaborator

BackOrder commented Oct 25, 2016

@ccoupe thanks for explaining. Hash is simpler. ;)

By the way, does color: supports rgb() values? It should be noted that other Shoes methods support Shoes colornames, such as background, which does not use quotes as in Test/plot/gr3.rb. Consistency is important.

Hopefully you understand that I am not nitpicking. The chart feature is absolutely fantastic. I remember wanting to get some Java charting in the past but the only decent packages were available for sales. So it's refreshing to get it for Shoes.

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Oct 25, 2016

Contributor

@BackOrder, yes i do agree, C functions should check for a ruby color (rgb or named) in the hash given to plot related methods (like texts, shapes, etc ... do for stroke, fill and those you mentioned, background, border ...).
The whole plot extravaganza is shiny enough now to spend time on killer "details" :-)

Contributor

passenger94 commented Oct 25, 2016

@BackOrder, yes i do agree, C functions should check for a ruby color (rgb or named) in the hash given to plot related methods (like texts, shapes, etc ... do for stroke, fill and those you mentioned, background, border ...).
The whole plot extravaganza is shiny enough now to spend time on killer "details" :-)

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 26, 2016

Contributor

I welcome help and you are helping: Turns out the plot color can easily be handled as you suggest. Bonus points because I get to delete some ugly code. I wasn't fond of the string myself. Fixed.

Another annoyance is having to use strings for "dot" and "rect" - I'd prefer symbols :dot and :rect . Opinions?

The radar/spider chart ineed a lot help if someone has some extra time.

Contributor

ccoupe commented Oct 26, 2016

I welcome help and you are helping: Turns out the plot color can easily be handled as you suggest. Bonus points because I get to delete some ugly code. I wasn't fond of the string myself. Fixed.

Another annoyance is having to use strings for "dot" and "rect" - I'd prefer symbols :dot and :rect . Opinions?

The radar/spider chart ineed a lot help if someone has some extra time.

ccoupe added a commit that referenced this issue Oct 26, 2016

on #264 - colors don't need string args just use a Shoes color object
*  which includes the built in Colors, and rgb() calls.
*  adds some more flesh to chart_series methods.
@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 26, 2016

Collaborator

Great!

Another annoyance is having to use strings for "dot" and "rect" - I'd prefer symbols :dot and :rect . Opinions?

Can't we have similar thing as Shoes colours? That would end up with dot and rect directly (without quotes or colon). Otherwise symbols would be fine as far as Ruby goes but it's always a bit strange to use with named parameters, such as points: :dot (a lot of colons if you notice).

The radar/spider chart ineed a lot help if someone has some extra time.

What's the TODO list on this one?

Collaborator

BackOrder commented Oct 26, 2016

Great!

Another annoyance is having to use strings for "dot" and "rect" - I'd prefer symbols :dot and :rect . Opinions?

Can't we have similar thing as Shoes colours? That would end up with dot and rect directly (without quotes or colon). Otherwise symbols would be fine as far as Ruby goes but it's always a bit strange to use with named parameters, such as points: :dot (a lot of colons if you notice).

The radar/spider chart ineed a lot help if someone has some extra time.

What's the TODO list on this one?

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 26, 2016

Contributor

For better or worse, all of the color names are real Shoes objects in the Shoes name space. While we could do something similar and create Shoes classes for dot, box, rect, and circle, I am not comfortable that - it could to break existing scripts that have those class names. At the C level, I'm not happy to pollute Ruby space with the :symbols either but since "Shoes is not Ruby it only looks like it", symbols seem a better choice at the moment. (assuming I do anything)

What's the TODO list on this one?

Huge. I don't know a sin() from a cos(), radians from degrees, and when to use one vs the other. The code in there is wrong (converted from pycha). One of the magazines I read (Car and Driver) presents their results in a spider graphs (they also get complaints about them - but that's not our problem to solve). Radial axis can run from small number near the center to larger number on the edge. Or larger numbers at the center and smaller at the edge - depending on how they define goodness. - a reversal of current min/max - The code in there might handle that, might not - I suspect not. Then there is issue of labels. One of the charts in your example way above this comment appears to use axis in 0->100,000 but the labels are 50, 70, 90. Another reason for the &blk the chart_series/hash/Thing_X, on add.

Contributor

ccoupe commented Oct 26, 2016

For better or worse, all of the color names are real Shoes objects in the Shoes name space. While we could do something similar and create Shoes classes for dot, box, rect, and circle, I am not comfortable that - it could to break existing scripts that have those class names. At the C level, I'm not happy to pollute Ruby space with the :symbols either but since "Shoes is not Ruby it only looks like it", symbols seem a better choice at the moment. (assuming I do anything)

What's the TODO list on this one?

Huge. I don't know a sin() from a cos(), radians from degrees, and when to use one vs the other. The code in there is wrong (converted from pycha). One of the magazines I read (Car and Driver) presents their results in a spider graphs (they also get complaints about them - but that's not our problem to solve). Radial axis can run from small number near the center to larger number on the edge. Or larger numbers at the center and smaller at the edge - depending on how they define goodness. - a reversal of current min/max - The code in there might handle that, might not - I suspect not. Then there is issue of labels. One of the charts in your example way above this comment appears to use axis in 0->100,000 but the labels are 50, 70, 90. Another reason for the &blk the chart_series/hash/Thing_X, on add.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 26, 2016

Collaborator

re: namespace

This is an important question. Creating additional Shoes objects would promote consistency and better syntax but your argument that it might break existing code is absolutely valid. It may not have big impact or may be expected from upgrading process but it's still important enough to consider before moving forward with such approach.

Ruby symbols would be an alternative and we could depreciate Shoes objects (such as colour names) via a warning in Shoes console to once again promote consistency. The depreciation would include support of colour name as symbols and we would phase out Shoes objects some future release.

This is something to think about because Shoes has been having increasingly new features since you took over the development. It comes to reason we need to have some kind of guideline.

re: math

Ruby Math (and most programming API) only support radians. One radian equals 1/2π. Degrees are something human enjoys and goes from 0 to 360 degrees for a full circle; exceeding values results in circling again, negative values for counterclockwise.

What you need to know is that 2π radian equals full circle (360 degrees). You use this reference to know how to split equally. You have X values on a radar chart? 2π / X.

Something along this line... not sure whether it is helpful to you...

Collaborator

BackOrder commented Oct 26, 2016

re: namespace

This is an important question. Creating additional Shoes objects would promote consistency and better syntax but your argument that it might break existing code is absolutely valid. It may not have big impact or may be expected from upgrading process but it's still important enough to consider before moving forward with such approach.

Ruby symbols would be an alternative and we could depreciate Shoes objects (such as colour names) via a warning in Shoes console to once again promote consistency. The depreciation would include support of colour name as symbols and we would phase out Shoes objects some future release.

This is something to think about because Shoes has been having increasingly new features since you took over the development. It comes to reason we need to have some kind of guideline.

re: math

Ruby Math (and most programming API) only support radians. One radian equals 1/2π. Degrees are something human enjoys and goes from 0 to 360 degrees for a full circle; exceeding values results in circling again, negative values for counterclockwise.

What you need to know is that 2π radian equals full circle (360 degrees). You use this reference to know how to split equally. You have X values on a radar chart? 2π / X.

Something along this line... not sure whether it is helpful to you...

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 27, 2016

Contributor

For now, I'm going to leave points and a few others as strings args until I think harder about symbols and learn how to use them at the C level. I think I know and what I think is ok-maybe.

What you need to know is that 2π radian equals full circle (360 degrees). You use this reference to know how to split equally. You have X values on a radar chart? 2π / X.

That bit of knowledge helps. I 'll review the the pycha radar to C/cairo conversion with that extra info.

Contributor

ccoupe commented Oct 27, 2016

For now, I'm going to leave points and a few others as strings args until I think harder about symbols and learn how to use them at the C level. I think I know and what I think is ok-maybe.

What you need to know is that 2π radian equals full circle (360 degrees). You use this reference to know how to split equally. You have X values on a radar chart? 2π / X.

That bit of knowledge helps. I 'll review the the pycha radar to C/cairo conversion with that extra info.

ccoupe added a commit that referenced this issue Oct 27, 2016

for #264 - chart_series fun
* see Test/plot/cstest.rb for odd things that can be done.
* just getting started on the manual.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 27, 2016

Contributor

One use case for chart_series (aka Thing_X): Imagine you want to monitor the temperature of a probe in a BBQ smoker - when its running between set points of 225F and 240F you draw a black line/datapoint on the graph. If it drops below 225F then draw a blue line and if rises above 240F then draw a red line. Imagine it spikes up to 280 and you need rescale the y axis too. You'll need getters and setters for all the hash arguments for chart_series (plot.add) but if you don't have a backing object then those would be getters and setters on the plot object and each of them would require an index or hash arg to pick which series to modify. Unclean in C and unclean in Shoes.

See Test/plots/cstest.rb - it appends (label, value) but it can also replace existing (label, value) - just change that 7 to a 3 for example. Also note in gr4.rb that it uses the return object of a plot.add (currently a chart_series).

Contributor

ccoupe commented Oct 27, 2016

One use case for chart_series (aka Thing_X): Imagine you want to monitor the temperature of a probe in a BBQ smoker - when its running between set points of 225F and 240F you draw a black line/datapoint on the graph. If it drops below 225F then draw a blue line and if rises above 240F then draw a red line. Imagine it spikes up to 280 and you need rescale the y axis too. You'll need getters and setters for all the hash arguments for chart_series (plot.add) but if you don't have a backing object then those would be getters and setters on the plot object and each of them would require an index or hash arg to pick which series to modify. Unclean in C and unclean in Shoes.

See Test/plots/cstest.rb - it appends (label, value) but it can also replace existing (label, value) - just change that 7 to a 3 for example. Also note in gr4.rb that it uses the return object of a plot.add (currently a chart_series).

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 27, 2016

Collaborator

So Shoes charting allow realtime data and other modifications?

Collaborator

BackOrder commented Oct 27, 2016

So Shoes charting allow realtime data and other modifications?

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 27, 2016

Contributor

So Shoes charting allow realtime data and other modifications?

One of my design goals. Fundamental. Not RT as process control people think but, every second or two.

Contributor

ccoupe commented Oct 27, 2016

So Shoes charting allow realtime data and other modifications?

One of my design goals. Fundamental. Not RT as process control people think but, every second or two.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 27, 2016

Collaborator

I'm looking forward to it. :D

Collaborator

BackOrder commented Oct 27, 2016

I'm looking forward to it. :D

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 27, 2016

Contributor

Already there in gr1.rb which adds random data points every 5 seconds.

Contributor

ccoupe commented Oct 27, 2016

Already there in gr1.rb which adds random data points every 5 seconds.

ccoupe added a commit that referenced this issue Oct 27, 2016

for #264 - manual might be useful.
* need to document more chart_series methods.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 27, 2016

Contributor

New beta available . Seems to mostly work Windows for graph tests but you need the graph test script which you only get from github sync. Perhaps my test scripts need to be in samples? expert-plot1.rb ...expert-plot6.rb ? Ick.

Contributor

ccoupe commented Oct 27, 2016

New beta available . Seems to mostly work Windows for graph tests but you need the graph test script which you only get from github sync. Perhaps my test scripts need to be in samples? expert-plot1.rb ...expert-plot6.rb ? Ick.

ccoupe added a commit that referenced this issue Oct 29, 2016

update manual for #264 plot and chart series.
* add samples/good-plots.rb - display all types
  also demontrates that their is gtk refresh/widget redraw issue
  previously noted on Windows.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 29, 2016

Contributor

Who knew? Gruff is a ruby (rails gem) that draws all kinds of charts, including spider, using rmagick as the backend but at the Ruby level the code is pretty similar to what C/Cairo uses. Anyone attempting #266 charting package might want to start with this.

Contributor

ccoupe commented Oct 29, 2016

Who knew? Gruff is a ruby (rails gem) that draws all kinds of charts, including spider, using rmagick as the backend but at the Ruby level the code is pretty similar to what C/Cairo uses. Anyone attempting #266 charting package might want to start with this.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 29, 2016

Collaborator

It would have been nice but Gruff doesn't seem maintained anymore. The last commit is 5 months old and issues are dating in years.

Furthermore, rmagick as a backend might not be suitable for realtime graphs.

Collaborator

BackOrder commented Oct 29, 2016

It would have been nice but Gruff doesn't seem maintained anymore. The last commit is 5 months old and issues are dating in years.

Furthermore, rmagick as a backend might not be suitable for realtime graphs.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 29, 2016

Contributor

Gruff is source code to copy and modify ourselves. It's not too old and it does work within it's limits and they have test data, scripts and test output. It's hard to install (even on ubuntu and probably very difficult for windows). I would never use it as a gem to include in Shoes.

The algorithms inside are the value to me (and the test's, so I know that it should look like). I doubt anyone will modify the Ruby code to use Shoes shape drawing code in place of rmagick , but they could (#266).

Contributor

ccoupe commented Oct 29, 2016

Gruff is source code to copy and modify ourselves. It's not too old and it does work within it's limits and they have test data, scripts and test output. It's hard to install (even on ubuntu and probably very difficult for windows). I would never use it as a gem to include in Shoes.

The algorithms inside are the value to me (and the test's, so I know that it should look like). I doubt anyone will modify the Ruby code to use Shoes shape drawing code in place of rmagick , but they could (#266).

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 30, 2016

Contributor

We have radial axis.
radar-1

Contributor

ccoupe commented Oct 30, 2016

We have radial axis.
radar-1

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Oct 30, 2016

Collaborator

Good. I'd like to recommend a 90 degrees rotation to match other radar graphs samples we shown here (e.g. LibreOffice). You will certainly notice the starting point on your graph is on right-middle quadrant. LibreOffice et co. would normally start on top-middle quadrant.

Collaborator

BackOrder commented Oct 30, 2016

Good. I'd like to recommend a 90 degrees rotation to match other radar graphs samples we shown here (e.g. LibreOffice). You will certainly notice the starting point on your graph is on right-middle quadrant. LibreOffice et co. would normally start on top-middle quadrant.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Oct 31, 2016

Contributor

I was working from the simpler spider in gruff which for whatever reason draws it with that start position. What we really want is Gruff's 'net' chart, which is a bit more complex but easier to comprehend than the pycha code.

Contributor

ccoupe commented Oct 31, 2016

I was working from the simpler spider in gruff which for whatever reason draws it with that start position. What we really want is Gruff's 'net' chart, which is a bit more complex but easier to comprehend than the pycha code.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Nov 2, 2016

Contributor

This issue is getting a little slow to load and it won't get faster. I've opened #288 for radar/spider issues.

Contributor

ccoupe commented Nov 2, 2016

This issue is getting a little slow to load and it won't get faster. I've opened #288 for radar/spider issues.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Nov 15, 2016

Collaborator

I am not a huge fan of pie_percent on L019. How about just percent?

Collaborator

BackOrder commented Nov 15, 2016

I am not a huge fan of pie_percent on L019. How about just percent?

ccoupe added a commit that referenced this issue Nov 18, 2016

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jan 21, 2017

Contributor

Closed in Shoes 3.3.2

Contributor

ccoupe commented Jan 21, 2017

Closed in Shoes 3.3.2

@ccoupe ccoupe closed this Jan 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment