Charting graphs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Charting graphs

abergel
Hi!

RTGraphBuilder went through major improvements.
- min and max may be specified. 
- plugins to add some decoration (average line, standard deviation range, ticks lines, …)

Here are some examples, with some examples, which should illustrate these points:
Is obtained with: 
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
| b ds |
b := RTGrapherBuilder new.

ds := RTDataSet new.
ds points: (0 to: 100 by: 0.1).
ds y: [ :x | (0.1 * x) sin  ].
ds noDot.
ds interaction popupText: 'sinus'.
ds connectColor: Color blue.
b add: ds.

ds := RTDataSet new.
ds points: (0 to: 100 by: 0.1).
ds y: [ :x | (0.2 * x) cos * 2 ].
ds noDot.
ds interaction popupText: 'cosinus'.
ds connectColor: Color red.
b add: ds.

b minY: -4.
b maxY: 4.
b minX: -25.

b build.
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
 

-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

b := RTGrapherBuilder new.

ds := RTStackedDataSet new.
ds interaction popup.
ds points: #(600 470 170 430 300).
ds barShape width: 20; color: Color lightGreen.
b add: ds.

b axisX noLabel; noTick.
b axisY noDecimals.

b addPlugin: RTMeanDevVarPlugin new.
b build
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

Another example:
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
b := RTGrapherBuilder new.
b extent: 300 @ 200.

5 timesRepeat: [ 
ds := RTStackedDataSet new.
ds noDot.
ds points: ((1 to: 500) collect: [ :i | 50 atRandom - 25 ]) cumsum.
ds connectColor: Color green.
b add: ds.
].

b addPlugin: RTMeanDevVarPlugin new.
b build.
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

The plugin framework exposes to a plugin all the necessary to define a whole range of decorations. For example, variable average lines, linear regression should be trivial to add...

Happy new year!
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Charting graphs

Tudor Girba-2
Pretty cool.

The API is interesting. As I see it, this will be limited to things like bar, plots or line graphs. For example, a spider chart will not work with this one, but it will use a builder of its own, right?

Some feedback:
- I would rename Plugin to Decorator. From your statement, "The plugin framework exposes to a plugin all the necessary to define a whole range of decorations" it seems to me that "Decorator" fits better.
- I would just call the class RTGrapher
- I do not quite understand how to distinguish the difference between DataSet and StackedDataSet.

Cheers,
Doru



On Mon, Jan 5, 2015 at 12:22 AM, Alexandre Bergel <[hidden email]> wrote:
Hi!

RTGraphBuilder went through major improvements.
- min and max may be specified. 
- plugins to add some decoration (average line, standard deviation range, ticks lines, …)

Here are some examples, with some examples, which should illustrate these points:
Is obtained with: 
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
| b ds |
b := RTGrapherBuilder new.

ds := RTDataSet new.
ds points: (0 to: 100 by: 0.1).
ds y: [ :x | (0.1 * x) sin  ].
ds noDot.
ds interaction popupText: 'sinus'.
ds connectColor: Color blue.
b add: ds.

ds := RTDataSet new.
ds points: (0 to: 100 by: 0.1).
ds y: [ :x | (0.2 * x) cos * 2 ].
ds noDot.
ds interaction popupText: 'cosinus'.
ds connectColor: Color red.
b add: ds.

b minY: -4.
b maxY: 4.
b minX: -25.

b build.
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
 

-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

b := RTGrapherBuilder new.

ds := RTStackedDataSet new.
ds interaction popup.
ds points: #(600 470 170 430 300).
ds barShape width: 20; color: Color lightGreen.
b add: ds.

b axisX noLabel; noTick.
b axisY noDecimals.

b addPlugin: RTMeanDevVarPlugin new.
b build
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

Another example:
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
b := RTGrapherBuilder new.
b extent: 300 @ 200.

5 timesRepeat: [ 
ds := RTStackedDataSet new.
ds noDot.
ds points: ((1 to: 500) collect: [ :i | 50 atRandom - 25 ]) cumsum.
ds connectColor: Color green.
b add: ds.
].

b addPlugin: RTMeanDevVarPlugin new.
b build.
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

The plugin framework exposes to a plugin all the necessary to define a whole range of decorations. For example, variable average lines, linear regression should be trivial to add...

Happy new year!
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Charting graphs

abergel
Hi Doru,

The API is interesting. As I see it, this will be limited to things like bar, plots or line graphs. For example, a spider chart will not work with this one, but it will use a builder of its own, right?

Yes. Currently, spider chart shares very little from what we have. This is why it deserves its own builder. Maybe this will change in the future, but for now it works well.
But the way, we call Kiviat what you call Spider chart. Just have a look at RTKiviatBuilder. 

Here is a screenshot for people who do not understand what we are talking about :-)

Some feedback:
- I would rename Plugin to Decorator. From your statement, "The plugin framework exposes to a plugin all the necessary to define a whole range of decorations" it seems to me that "Decorator" fits better.

Yes!
Done!

- I would just call the class RTGrapher

Yes, done!


- I do not quite understand how to distinguish the difference between DataSet and StackedDataSet.

Yeah, not easy to grasp. Consider an histogram and a scatter plot.
You will define an histogram as a list of values, e.g,. 4, 5, 6, 7
You will define a scatterplot as a list of points, e.g., 2 @ 3, 5 @ 6, …

An histogram is obtained from a list of objects, and a function Y to obtain the values.
A scatter plot is obtained from a list of objects, and _two_ functions X and Y to obtain the points.

When you do not need to specify an X, e.g., an histogram, then you need a RTStackedDataSet.
When you need to specify an X, e.g., a scatter plot, then you need a RTDataSet.

Is it clear? Maybe the vocabulary we use is not obvious. 

Cheers,
Alexandre


Cheers,
Doru



On Mon, Jan 5, 2015 at 12:22 AM, Alexandre Bergel <[hidden email]> wrote:
Hi!

RTGraphBuilder went through major improvements.
- min and max may be specified. 
- plugins to add some decoration (average line, standard deviation range, ticks lines, …)

Here are some examples, with some examples, which should illustrate these points:
<Screen Shot 2015-01-04 at 8.08.05 PM.png>
Is obtained with: 
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
| b ds |
b := RTGrapherBuilder new.

ds := RTDataSet new.
ds points: (0 to: 100 by: 0.1).
ds y: [ :x | (0.1 * x) sin  ].
ds noDot.
ds interaction popupText: 'sinus'.
ds connectColor: Color blue.
b add: ds.

ds := RTDataSet new.
ds points: (0 to: 100 by: 0.1).
ds y: [ :x | (0.2 * x) cos * 2 ].
ds noDot.
ds interaction popupText: 'cosinus'.
ds connectColor: Color red.
b add: ds.

b minY: -4.
b maxY: 4.
b minX: -25.

b build.
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
 

<Screen Shot 2015-01-04 at 8.13.51 PM.png>
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

b := RTGrapherBuilder new.

ds := RTStackedDataSet new.
ds interaction popup.
ds points: #(600 470 170 430 300).
ds barShape width: 20; color: Color lightGreen.
b add: ds.

b axisX noLabel; noTick.
b axisY noDecimals.

b addPlugin: RTMeanDevVarPlugin new.
b build
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

Another example:
<Screen Shot 2015-01-04 at 8.17.51 PM.png>
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 
b := RTGrapherBuilder new.
b extent: 300 @ 200.

5 timesRepeat: [ 
ds := RTStackedDataSet new.
ds noDot.
ds points: ((1 to: 500) collect: [ :i | 50 atRandom - 25 ]) cumsum.
ds connectColor: Color green.
b add: ds.
].

b addPlugin: RTMeanDevVarPlugin new.
b build.
-=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= -=-=-=-=-=-= 

The plugin framework exposes to a plugin all the necessary to define a whole range of decorations. For example, variable average lines, linear regression should be trivial to add...

Happy new year!
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Charting graphs

Tudor Girba-2
Hi,


On Tue, Jan 6, 2015 at 10:37 PM, Alexandre Bergel <[hidden email]> wrote:
Hi Doru,

The API is interesting. As I see it, this will be limited to things like bar, plots or line graphs. For example, a spider chart will not work with this one, but it will use a builder of its own, right?

Yes. Currently, spider chart shares very little from what we have. This is why it deserves its own builder. Maybe this will change in the future, but for now it works well.
But the way, we call Kiviat what you call Spider chart. Just have a look at RTKiviatBuilder. 

I saw it already. I asked about the future intention. What can be reused between Grapher and Kiviat are the axis logic. This is what we had in EyeSee and it worked well.

 [...]
- I do not quite understand how to distinguish the difference between DataSet and StackedDataSet.

Yeah, not easy to grasp. Consider an histogram and a scatter plot.
You will define an histogram as a list of values, e.g,. 4, 5, 6, 7

What you call a histogram is actually just a bar chart :). The histogram is a way to represent the distribution of data, not individual data points. I would rename the vocabulary to use the term "bar (chart)"  instead of histogram.

You will define a scatterplot as a list of points, e.g., 2 @ 3, 5 @ 6, …

An histogram is obtained from a list of objects, and a function Y to obtain the values.
A scatter plot is obtained from a list of objects, and _two_ functions X and Y to obtain the points.

When you do not need to specify an X, e.g., an histogram, then you need a RTStackedDataSet.
When you need to specify an X, e.g., a scatter plot, then you need a RTDataSet. 

Is it clear? Maybe the vocabulary we use is not obvious. 

Yes, I understood this before but the names do not say that. Some names that come to mind are:
- RTUnidimensionalData/RTBidimensionalData or
- RTXData/RTXYData.

But, I would want to raise another point: 

The decomposition is now based on the kind of data and it is the data that specifies if it wants to be represented as bars of lines. This can work if we consider bars and lines. However, if you want to implement a real histogram it won't work well because it would require you provide a list of items and a function to group them into chunks and you would show those chunks. So, you would build a RTHistogramDataSet. What's more, this histogram would work only with bar shapes.

So, perhaps a better decomposition is via the chart type. At least, this is what we learnt from EyeSee and Graph-ET. Of course, we could also build another RTHistogramBuilder altogether, like for Kiviat, but we might be missing reusability and uniformity. I think it would be useful to think about the implications at this point.

Cheers,
Doru
 


--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

Screen Shot 2015-01-06 at 6.26.48 PM.png (54K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Charting graphs

abergel
I saw it already. I asked about the future intention. What can be reused between Grapher and Kiviat are the axis logic. This is what we had in EyeSee and it worked well.

This is what we have actually. RTAxisConfiguration and RTAxisRenderer are instead used by Grapher and Kiviat.


 [...]
- I do not quite understand how to distinguish the difference between DataSet and StackedDataSet.

Yeah, not easy to grasp. Consider an histogram and a scatter plot.
You will define an histogram as a list of values, e.g,. 4, 5, 6, 7

What you call a histogram is actually just a bar chart :). The histogram is a way to represent the distribution of data, not individual data points. I would rename the vocabulary to use the term "bar (chart)"  instead of histogram.

Well spotted!
I replaced referenced of “histogram” by “bar chart"


You will define a scatterplot as a list of points, e.g., 2 @ 3, 5 @ 6, …

An histogram is obtained from a list of objects, and a function Y to obtain the values.
A scatter plot is obtained from a list of objects, and _two_ functions X and Y to obtain the points.

When you do not need to specify an X, e.g., an histogram, then you need a RTStackedDataSet.
When you need to specify an X, e.g., a scatter plot, then you need a RTDataSet. 

Is it clear? Maybe the vocabulary we use is not obvious. 

Yes, I understood this before but the names do not say that. Some names that come to mind are:
- RTUnidimensionalData/RTBidimensionalData or

These names are a bit long

- RTXData/RTXYData.

Yes, could be. 

But, I would want to raise another point: 

The decomposition is now based on the kind of data and it is the data that specifies if it wants to be represented as bars of lines. This can work if we consider bars and lines. However, if you want to implement a real histogram it won't work well because it would require you provide a list of items and a function to group them into chunks and you would show those chunks. So, you would build a RTHistogramDataSet. What's more, this histogram would work only with bar shapes.

So, perhaps a better decomposition is via the chart type. At least, this is what we learnt from EyeSee and Graph-ET. Of course, we could also build another RTHistogramBuilder altogether, like for Kiviat, but we might be missing reusability and uniformity. I think it would be useful to think about the implications at this point.

This is something that I have thought a lot. I agree with you in principle. However, having the Grapher modular with the maximum reuse is not the big challenge I see right now. Big things are missing in Grapher now, that may have an impact on the whole design. For example, consider the script:

-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGrapher new.
b extent: 200 @ 200.

ds := RTStackedDataSet new.
ds points: #(-0.5 1).
ds barShape width: 30.
b add: ds.

b axisX noLabel; noTick.
b
-=-=-=-=-=-=-=-=-=-=-=-=

The produced graph is the following:



The X-axis is not on the 0 value. And this is a big problem. You can always fiddle with the number of ticks, the minimum and maximum values, but this has to be done manually. Excel does it automatically. Unfortunately, the algorithm behind is not simple (this is an optimization problem, for which there are even some research paper).

Another problem I see, is to have logarithmic scale. Actually, I suspect there is no major difficulty, excepting finding the time to do it.

Having smart ticks and logarithmic scales are the priority for now. Once we have this, we may rethink about the whole architecture. 

Cheers,
Alexandre


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev