CairoPlot port to Lua

51 views
Skip to first unread message

Lucas Hermann Negri

unread,
Jul 2, 2009, 5:19:33 PM7/2/09
to cair...@googlegroups.com
Hello,

I've just released LuaPlot (
http://oproj.tuxfamily.org/wiki/doku.php?id=luaplot ) , a 'port' of
CairoPlot to Lua. In fact, only the drawing logic where reused, since
I'm using pango for the text layout, I've separated the plot surface
handling to ease the drawing on different surfaces (like on GTK+
widgets) and separated the legend as another plot, allowing 'child'
plots.

I still suggest a rewrite of CairoPlot to C =) (so we could just
create bindings to Python, Lua, etc. I would help on my free time).

--
http://oproj.tuxfamily.org

Rodrigo Araújo

unread,
Jul 2, 2009, 6:21:10 PM7/2/09
to cair...@googlegroups.com
Hey,

It surely is a great idea. I haven't had much time these days and, on the near future, I intend to focus on releasing version 1.2.
But feel free to start this project and, as soon as I can, I'll join you.

Thanks,

Rodrigo

Lucas Hermann Negri

unread,
Jul 2, 2009, 6:35:27 PM7/2/09
to cair...@googlegroups.com
Great!

I'm in a hurry too (did this quick port because of that), but I'll
start this ASAP (may take some time).

Thanks again for CairoPlot.
--
http://oproj.tuxfamily.org

Rodrigo Araújo

unread,
Jul 2, 2009, 6:38:29 PM7/2/09
to cair...@googlegroups.com
I'm really glad you like CairoPlot!
Do you work in RJ (asking because I happen to know Lua was created here)? 
What are you planning to use LuaPlot on?

Magnun Leno

unread,
Jul 2, 2009, 6:43:40 PM7/2/09
to cair...@googlegroups.com
Hey, nice one!!
If someone start writing CairoPlot in C I'll be glad to help too!

Magnun Leno

Lucas Hermann Negri

unread,
Jul 2, 2009, 8:35:09 PM7/2/09
to cair...@googlegroups.com
Magnum and Rodrigo, its good to know that we share the same opinion. I
can create the 'base' project and host it, but the design /
architecture must be discussed first.

Rodrigo, I'm from Joinville (SC) (unfortunately I never went to PUC),
and I'm using it for two projects: for an neural network simulator
(plot the mean squared error during the training) and for a small ERP
(to plot information like sales / month and etc).
--
http://oproj.tuxfamily.org

Felipe Sanches

unread,
Jul 2, 2009, 10:57:05 PM7/2/09
to cair...@googlegroups.com
e aí, pessoal! Primeiramente, que coisa "mané" ficar falando em inglês quando todas as 4 pessoas são brasileiras... :-P

Eu também apóio o port pra C. Talvez eu ajude. Mas não posso garantir isso pq estou cheio de iniciativas em outros projetos de software livre, como o Inkscape, a LibreDWG e algumas outras idéias aleatórias...

Fica aqui meu forte incentivo para que levem adiante essa idéia do port C + bindings para múltiplas linguagens. Certamente eu vou dar uma olhada no código e dar alguns palpites assim que ele começar a surgir. Talvez eu acabe mandando uns patches. Sempre sinto uma vontade de cutucar um pouco os projetos :-) Não há como resistir à tentação de dar uma contribuída aqui e alí!

t+,
Juca

Lucas Hermann Negri

unread,
Jul 2, 2009, 11:13:47 PM7/2/09
to cair...@googlegroups.com
Hehe, é verdade, mas a conversa pode interessar a outros assinantes da
lista também.
--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 3, 2009, 8:22:39 AM7/3/09
to CairoPlot
I there people!

i was looking for a library that could plot trends. I need it to
include in a C program.
I saw gtkdatabo, but cairoplot seems much nicier.
So ... i am a ++ for a C port. I am going for it this weekend and,
cairo plot python is in bzr, cairo plot lua in arch ... well ... i'll
use github to provide the library.
Maybe we should work in the bindings after?

I would like to have the agreement of the original author, Rodrigo, so
we can use the cairoplot's name and all (i would like just to shift
from python, to C + bindings)...

basically, all i want is to rewrite cairoplot from the python one.

well ... ??

best regards
Luis Matos


On Jul 3, 4:13 am, Lucas Hermann Negri <kknd...@gmail.com> wrote:
> Hehe, é verdade, mas a conversa pode interessar a outros assinantes da
> lista também.
>
>
>
> On Thu, Jul 2, 2009 at 11:57 PM, Felipe Sanches<felipe.sanc...@gmail.com> wrote:
> > e aí, pessoal! Primeiramente, que coisa "mané" ficar falando em inglês
> > quando todas as 4 pessoas são brasileiras... :-P
>
> > Eu também apóio o port pra C. Talvez eu ajude. Mas não posso garantir isso
> > pq estou cheio de iniciativas em outros projetos de software livre, como o
> > Inkscape, a LibreDWG e algumas outras idéias aleatórias...
>
> > Fica aqui meu forte incentivo para que levem adiante essa idéia do port C +
> > bindings para múltiplas linguagens. Certamente eu vou dar uma olhada no
> > código e dar alguns palpites assim que ele começar a surgir. Talvez eu acabe
> > mandando uns patches. Sempre sinto uma vontade de cutucar um pouco os
> > projetos :-) Não há como resistir à tentação de dar uma contribuída aqui e
> > alí!
>
> > t+,
> > Juca
>
> > On Thu, Jul 2, 2009 at 9:35 PM, Lucas Hermann Negri <kknd...@gmail.com>
> > wrote:
>
> >> Magnum and Rodrigo, its good to know that we share the same opinion. I
> >> can create the 'base' project and host it, but  the design /
> >> architecture  must be discussed first.
>
> >> Rodrigo, I'm from Joinville (SC) (unfortunately I never went to PUC),
> >> and I'm using it for two projects: for an neural network simulator
> >> (plot the mean squared error during the training) and for a small ERP
> >> (to plot information like sales / month and etc).
>
> >> On Thu, Jul 2, 2009 at 7:43 PM, Magnun Leno<magnun.l...@gmail.com> wrote:
> >> > Hey, nice one!!
> >> > If someone start writing CairoPlot in C I'll be glad to help too!
>
> >> > Magnun Leno
>
> >> > On Thu, Jul 2, 2009 at 7:38 PM, Rodrigo Araújo <alf.rodr...@gmail.com>
> >> > wrote:
>
> >> >> I'm really glad you like CairoPlot!
> >> >> Do you work in RJ (asking because I happen to know Lua was created
> >> >> here)?
> >> >> What are you planning to use LuaPlot on?
> >> >> On Thu, Jul 2, 2009 at 7:35 PM, Lucas Hermann Negri <kknd...@gmail.com>
> >> >> wrote:
>
> >> >>> Great!
>
> >> >>> I'm in a hurry too (did this quick port because of that), but I'll
> >> >>> start this ASAP (may take some time).
>
> >> >>> Thanks again for CairoPlot.
>
> >> >>> On Thu, Jul 2, 2009 at 7:21 PM, Rodrigo Araújo<alf.rodr...@gmail.com>
> >> >>> wrote:
> >> >>> > Hey,
> >> >>> > It surely is a great idea. I haven't had much time these days and,
> >> >>> > on
> >> >>> > the
> >> >>> > near future, I intend to focus on releasing version 1.2.
> >> >>> > But feel free to start this project and, as soon as I can, I'll join
> >> >>> > you.
> >> >>> > Thanks,
> >> >>> > Rodrigo
>
> >> >>> > On Thu, Jul 2, 2009 at 6:19 PM, Lucas Hermann Negri
> >> >>> > <kknd...@gmail.com>
> >> >>> > wrote:
>
> >> >>> >> Hello,
>
> >> >>> >> I've just released LuaPlot (
> >> >>> >>http://oproj.tuxfamily.org/wiki/doku.php?id=luaplot) , a 'port' of

Rodrigo Araújo

unread,
Jul 3, 2009, 8:32:11 AM7/3/09
to cair...@googlegroups.com
Hey Luis,

There's no problem in using the original name, as moving CairoPlot native implementation to C is the idea being discussed here.
Let's do it guys!

Luis, please let us know when you start it and how to help.

Cheers,

Rodrigo Araújo

Luis Matos

unread,
Jul 3, 2009, 8:51:06 AM7/3/09
to CairoPlot
I'll start today or tomorrow. when i have some working code, i'll tell
you people.

i have to enter better in the cairo stuff, too.



On Jul 3, 1:32 pm, Rodrigo Araújo <alf.rodr...@gmail.com> wrote:
> Hey Luis,
> There's no problem in using the original name, as moving CairoPlot native
> implementation to C is the idea being discussed here.
> Let's do it guys!
>
> Luis, please let us know when you start it and how to help.
>
> Cheers,
>
> Rodrigo Araújo
>

Luis Matos

unread,
Jul 3, 2009, 8:52:19 AM7/3/09
to CairoPlot
I'll start today or tomorrow. when i have some working code, i'll tell
you people.

i have to enter better in the cairo stuff, too.



On Jul 3, 1:32 pm, Rodrigo Araújo <alf.rodr...@gmail.com> wrote:
> Hey Luis,
> There's no problem in using the original name, as moving CairoPlot native
> implementation to C is the idea being discussed here.
> Let's do it guys!
>
> Luis, please let us know when you start it and how to help.
>
> Cheers,
>
> Rodrigo Araújo
>

Lucas Hermann Negri

unread,
Jul 3, 2009, 10:26:18 AM7/3/09
to cair...@googlegroups.com
Great!

I suggest the separation of the surface creation / handling from the
plot, as it eases the integration with graphical toolkits and other
outputs ( I've implemented it in LuaPlot ). Let me know when you
create, so I can help too.
--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 3, 2009, 10:42:04 AM7/3/09
to CairoPlot
yep ... i want to do something like you did for lua.

i want to separate the plots as different widgets.

i'll post here when i have something.

Luis Matos

unread,
Jul 3, 2009, 11:38:07 AM7/3/09
to CairoPlot
Regarding the separation, i think it should be:
libcanvasplot (for x11, image, pdf)
libgtkcanvasplot (as a gtk widget)

and ... other toolkit bindings.

Lucas Hermann Negri

unread,
Jul 3, 2009, 11:46:46 AM7/3/09
to cair...@googlegroups.com
Its OK, the main point is to let the plot be generic (separate from
the output), since all it need for the drawing is the cairo context.
Getting that cairo context isn't the responsibility of the plot, so
letting the user to combine plots with handlers makes it more generic
and prevents the explosion of the number of classes (dependency
injection).
--
http://oproj.tuxfamily.org

Magnun Leno

unread,
Jul 3, 2009, 6:55:28 PM7/3/09
to cair...@googlegroups.com
I'm amazed how CairoPlot is growing! It's just incredible!

I'm a little rusted in C/C++ but I'll try to give some help! But I was thinking, it would be nice to use Launchpad for the source code, for a cuple of reasons:
  • CairoPlot already there;
  • We can create a CairoPlot ubuntu/debian repository;
  • We can create a CairoPlot developer team.
Well, it's just a cuple of ideas that came to me. We can make a pool to decide.

Magnun Leno

Luis Matos

unread,
Jul 4, 2009, 3:43:49 PM7/4/09
to CairoPlot
Hello!

i don't have an account in lp. but i recognize that that's the way.
but ... for now, a slow start is here:

http://github.com/gass/cairoplot/tree/master

it has some small rendering support of the main plot and a unit test,
so that we can check the results.

if anyone wants upload privileges, please mail this list, or me,
personally.

kind regards
Luis Matos

On 3 Jul, 23:55, Magnun Leno <magnun.l...@gmail.com> wrote:
> I'm amazed how CairoPlot is growing! It's just incredible!
>
> I'm a little rusted in C/C++ but I'll try to give some help! But I was
> thinking, it would be nice to use Launchpad for the source code, for a cuple
> of reasons:
>
>    - CairoPlot already there;
>    - We can create a CairoPlot ubuntu/debian repository;
>    - We can create a CairoPlot developer team.

Michael Wayne Goodman

unread,
Jul 4, 2009, 5:46:52 PM7/4/09
to cair...@googlegroups.com
Just thought I'd join in the chorus.

While I love Python, I'm all for a rewrite in C. I'd like to
contribute some code, but I probably won't have a lot of time except
maybe this August-September.

And regarding github/Launchpad... I like Launchpad and its team and
project management, but I'm sure github is good, too. Github seems to
have some site/wiki hosting, which is something Cairoplot needs.

(i was comparing the two with:
http://en.wikipedia.org/wiki/Comparison_of_open_source_software_hosting_facilities
)
--
-Michael Wayne Goodman

Felipe Sanches

unread,
Jul 4, 2009, 5:53:03 PM7/4/09
to cair...@googlegroups.com
just for fun...
"Write in C"
http://www.youtube.com/watch?v=XHosLhPEN3k

Luis Matos

unread,
Jul 4, 2009, 6:03:50 PM7/4/09
to cair...@googlegroups.com
Hello

github is just a "place"... the actual place for cairoplot is in
launchpad. No argue there. Because i am starting to be fan of git (no
flames here) i like github. That's temporary. when the code gets better,
i'll offer it to the original author of cairoplot.

later we can do those moves that convert all git's changelog to bzr
changelog.

just ... download the code (there is somewhere a download link), and try
it.

i just uploaded the use of several colors in the plot's background. that
needs tunned, but only after i have some plots working.

and the video about C, tends to be true.

best regards
Luis Matos

Lucas Hermann Negri

unread,
Jul 4, 2009, 6:50:56 PM7/4/09
to cair...@googlegroups.com
Hi,

Isn't it better to use GObject, keeping the plot class hierarchy? The
theme options can be put as properties too.
--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 4, 2009, 9:04:26 PM7/4/09
to cair...@googlegroups.com
True ... i'll see.

It will be easier to bind to other languages.

Lucas Hermann Negri

unread,
Jul 5, 2009, 11:43:28 PM7/5/09
to cair...@googlegroups.com
I've coded the initial/template boiler plate GObject code (it's
attached). It's just a (working) base to serve as initial code, it
isn't plotting charts yet =).

GObject coding can be very tedious, but in the end it worth the time spent.
--
http://oproj.tuxfamily.org
port-cairoplot.tar.bz2

Luis Matos

unread,
Jul 6, 2009, 3:43:33 AM7/6/09
to CairoPlot


On Jul 6, 4:43 am, Lucas Hermann Negri <kknd...@gmail.com> wrote:
> I've coded the initial/template boiler plate GObject code (it's
> attached). It's just a (working) base to serve as initial code, it
> isn't plotting charts yet =).
>
> GObject coding can be very tedious, but in the end it worth the time spent.

true ... i decided to develop something more, before doing that,
because i was a bit bored.

i am starting the scatter plot interface (in my code) and i can help
you with setting some properties to the general plot.
can you put the code under some version controller, so it can be
easier to track code changes and provide patches?

please check -> http://github.com/gass/cairoplot , to see if you would
like me to port my code to your GObject implementation.

thanks
Luis Matos
>
>
>
> On Sat, Jul 4, 2009 at 10:04 PM, Luis Matos<g...@otiliamatos.ath.cx> wrote:
>
> > True ... i'll see.
>
> > It will be easier to bind to other languages.
>
> > Sáb, 2009-07-04 às 19:50 -0300, Lucas Hermann Negri escreveu:
> >> Hi,
>
> >> Isn't it better to use GObject, keeping the plot class hierarchy?  The
> >> theme options can be put as properties too.
>
> >> On Sat, Jul 4, 2009 at 7:03 PM, Luis Matos<g...@otiliamatos.ath.cx> wrote:
>
> >> > Hello
>
> >> > github is just a "place"... the actual place for cairoplot is in
> >> > launchpad. No argue there. Because i am starting to be fan of git (no
> >> > flames here) i like github. That's temporary. when the code gets better,
> >> > i'll offer it to the original author of cairoplot.
>
> >> > later we can do those moves that convert all git's changelog to bzr
> >> > changelog.
>
> >> > just ... download the code (there is somewhere a download link), and try
> >> > it.
>
> >> > i just uploaded the use of several colors in the plot's background. that
> >> > needs tunned, but only after i have some plots working.
>
> >> > and the video about C, tends to be true.
>
> >> > best regards
> >> > Luis Matos
>
> >> > Sáb, 2009-07-04 às 14:46 -0700, Michael Wayne Goodman escreveu:
> >> >> Just thought I'd join in the chorus.
>
> >> >> While I love Python, I'm all for a rewrite in C. I'd like to
> >> >> contribute some code, but I probably won't have a lot of time except
> >> >> maybe this August-September.
>
> >> >> And regarding github/Launchpad... I like Launchpad and its team and
> >> >> project management, but I'm sure github is good, too. Github seems to
> >> >> have some site/wiki hosting, which is something Cairoplot needs.
>
> >> >> (i was comparing the two with:
> >> >>http://en.wikipedia.org/wiki/Comparison_of_open_source_software_hosti...
> >> >> )
>
> >> >> On Sat, Jul 4, 2009 at 12:43 PM, Luis Matos<g...@otiliamatos.ath.cx> wrote:
>
> >> >> > Hello!
>
> >> >> > i don't have an account in lp. but i recognize that that's the way.
> >> >> > but ... for now, a slow start is here:
>
> >> >> >http://github.com/gass/cairoplot/tree/master
>
> >> >> > it has some small rendering support of the main plot and a unit test,
> >> >> > so that we can check the results.
>
> >> >> > if anyone wants upload privileges, please mail this list, or me,
> >> >> > personally.
>
> >> >> > kind regards
> >> >> > Luis  Matos
>
> >> >> > On 3 Jul, 23:55, Magnun Leno <magnun.l...@gmail.com> wrote:
> >> >> >> I'm amazed how CairoPlot is growing! It's just incredible!
>
> >> >> >> I'm a little rusted in C/C++ but I'll try to give some help! But I was
> >> >> >> thinking, it would be nice to use Launchpad for the source code, for a cuple
> >> >> >> of reasons:
>
> >> >> >>    - CairoPlot already there;
> >> >> >>    - We can create a CairoPlot ubuntu/debian repository;
> >> >> >>    - We can create a CairoPlot developer team.
>
> >> >> >> Well, it's just a cuple of ideas that came to me. We can make a pool to
> >> >> >> decide.
>
> >> >> >> Magnun Leno
>
> --http://oproj.tuxfamily.org
>
>  port-cairoplot.tar.bz2
> 3KViewDownload

ga...@otiliamatos.ath.cx

unread,
Jul 6, 2009, 7:09:31 AM7/6/09
to cair...@googlegroups.com

Attached is a new plot.h and plot.c files, with support for the color
value and the color theme.

this maybe should be in a new color.h and color.c files.

also, CpPlot object now has background and border_color properties :)

ga...@otiliamatos.ath.cx

unread,
Jul 6, 2009, 7:09:47 AM7/6/09
to cair...@googlegroups.com
Attached is a new plot.h and plot.c files, with support for the color
value and the color theme.

this maybe should be in a new color.h and color.c files.

also, CpPlot object now has background and border_color properties :)

Em 7/6/2009, "Lucas Hermann Negri" <kkn...@gmail.com> escreveu:

new_plot.tar

Lucas Hermann Negri

unread,
Jul 6, 2009, 1:16:52 PM7/6/09
to cair...@googlegroups.com
> i am starting the scatter plot interface (in my code) and i can help
> you with setting some properties to the general plot.
> can you put the code under some version controller, so it can be
> easier to track code changes and provide patches?
> please check -> http://github.com/gass/cairoplot , to see if you would
> like me to port my code to your GObject implementation.

Sure. Repo created at http://github.com/kknd/cairoplot/tree/master .

> Attached is a new plot.h and plot.c files, with support for the color
> value and the color theme.

Nice. I'm a git newbie, so I'm still learning how to receive changes
from others (if I understood it correctly, each person works on a repo
clone and then the changes can be pulled and merged in the main repo,
that's correct?).

--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 6, 2009, 1:36:38 PM7/6/09
to cair...@googlegroups.com
yes, but ... i have lots of changes already made to your files, can i
put them on my repo, and you fork to yours? i will give you write
permission. (so you won't need to fork).

Lucas Hermann Negri

unread,
Jul 6, 2009, 3:13:39 PM7/6/09
to cair...@googlegroups.com
> yes, but ... i have lots of changes already made to your files, can i
> put them on my repo, and you fork to yours? i will give you write
> permission. (so you won't need to fork).

I already merged some of your changes (the color boxed type, with the
missing functions). 'my' (its not mine, ours would be a better
reference) repo is compiling. I think that the code in the repo must
always be compiling at least.

--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 6, 2009, 3:12:11 PM7/6/09
to cair...@googlegroups.com
http://github.com/gass/cairoplot

you're added here (you have permission to upload... it is there your
code and mine (previous) and mine (GObject).
the scatterplot.* and cairplot.* must go away.

i don't have time for more now

best regards.

Luis Matos

unread,
Jul 6, 2009, 5:01:15 PM7/6/09
to cair...@googlegroups.com
agreed ... sorry, but i had to leave home to eat some food. I wanted to
show you the code, because i had done a bunch of new code. I think once
you get the GObject's hand, its easy. And great!

Are you going to commit the background and the color theme stuff also?


Luis Matos

Lucas Hermann Negri

unread,
Jul 6, 2009, 8:59:42 PM7/6/09
to cair...@googlegroups.com
I think that first we must define the basic structures.

Things that need some thinking:

-> What data structure to use for labels? Must be easy to use from C
and from bindings, so maybe a custom class is needed.
-> What data structure use for plot data? Same issue with the labels,
maybe a custom class too.

The code on http://github.com/kknd/cairoplot/tree/master can render
using 'memory' and 'png' handlers, and can draw only a basic
background and border.

Maybe we can split the work? We discuss, and each of us pick a class
of it's liking to develop (first the basic ones, latter the plots). Is
this possible?

I'm really tired now, spent five hours trying to code this. Lua was
soooo easier =).
--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 6, 2009, 9:19:48 PM7/6/09
to cair...@googlegroups.com
Seg, 2009-07-06 às 21:59 -0300, Lucas Hermann Negri escreveu:
> I think that first we must define the basic structures.
>
> Things that need some thinking:
>
> -> What data structure to use for labels? Must be easy to use from C
> and from bindings, so maybe a custom class is needed.
> -> What data structure use for plot data? Same issue with the labels,
> maybe a custom class too.

The data structure should be of 3 types: 1D, 2D and 3D ( at least), and
should belong to the plot subobjects (scatterplot, pieplot, etc)
Also, with the data, comes the series.
Series have: labels and a list of points, 1d, 2D or 3D.

we can have a glist of structs like:

serie {
gchar *label;
float *x;
float *y;
float *z;
}

where you allocate the vectors you want.
if they are NULL, they are not used.

great would to be to have a file load, from csv to our data.

the labels,

>
> The code on http://github.com/kknd/cairoplot/tree/master can render
> using 'memory' and 'png' handlers, and can draw only a basic
> background and border.
>
> Maybe we can split the work? We discuss, and each of us pick a class
> of it's liking to develop (first the basic ones, latter the plots). Is
> this possible?

Yes, each one of us implements a plot type. can i get the scatter?

>
> I'm really tired now, spent five hours trying to code this. Lua was
> soooo easier =).

LOL

Luis Matos

unread,
Jul 6, 2009, 9:24:05 PM7/6/09
to cair...@googlegroups.com
Don't you think that we should have a type: color theme? or Color Array?

Background can have one or multiple colors. right?

Lucas Hermann Negri

unread,
Jul 6, 2009, 9:51:30 PM7/6/09
to cair...@googlegroups.com
Hi,

I agree about the background. It can be a plain color or a gradient,
but to make it generic can't we just accept a plain gradient (a cairo
source itself)? Is that what you mean by background of multiple
colors?

I think that arrays are better to use from C and from bindings, since
the data and the labels we create it one time and it doesn't changes
over time.

Do you think that the angle and color can be put in the CpLabel too? I
think it's a good thing.

I'm thinking of:

struct CpLabel
{
gchar** data;
CpColor* color;
gdouble angle;
guint size;
};

Providing two constructors:

cp_label_new_va(guint size, gchar* label, ...);
cp_label_new(gchar** data, guint size);

For the BarPlot data, that can be be grouped in series, what's a good
data structure?

--
http://oproj.tuxfamily.org

ga...@otiliamatos.ath.cx

unread,
Jul 7, 2009, 3:42:33 AM7/7/09
to cair...@googlegroups.com

Em 7/7/2009, "Lucas Hermann Negri" <kkn...@gmail.com> escreveu:

>
>Hi,
>
>I agree about the background. It can be a plain color or a gradient,
>but to make it generic can't we just accept a plain gradient (a cairo
>source itself)? Is that what you mean by background of multiple
>colors?

You can have a background of one color, fine.
But you can also have a color gradient (multiple colors), that you should
support.

After that, the user has to build its own pattern. Check my code, i have
color theme as a GList of colors. (i choose GList, but it can be a
pointer to a color array with the number of colors)

color_theme {
int n_colors
CpColor *colors

}

>
>I think that arrays are better to use from C and from bindings, since
>the data and the labels we create it one time and it doesn't changes
>over time.

based on a series object?



>
>Do you think that the angle and color can be put in the CpLabel too? I
>think it's a good thing.
>
>I'm thinking of:
>
>struct CpLabel
>{
> gchar** data;
> CpColor* color;
> gdouble angle;
> guint size;
>};
>
>Providing two constructors:
>
>cp_label_new_va(guint size, gchar* label, ...);
>cp_label_new(gchar** data, guint size);
>

i think this is great.

>For the BarPlot data, that can be be grouped in series, what's a good
>data structure?

maybe :

serie {
CpLabel * label
void (float) * data?

}

>
>--
>http://oproj.tuxfamily.org
>
>

Rodrigo Araújo

unread,
Jul 7, 2009, 7:43:43 AM7/7/09
to cair...@googlegroups.com
Guys, please check out the latest version on trunk.
A new module (series) has been added to model the series objects. It should be good to start coding from there since it's that module that, now, goes through all the trouble of converting the input to the expected formats.

Besides that, I'm amazed on how much effort you guys are putting here! That's really great! :D

Rodrigo

ga...@otiliamatos.ath.cx

unread,
Jul 7, 2009, 10:05:18 AM7/7/09
to cair...@googlegroups.com

so ... you have a group object that collects the data:
1D, 2D, 3D points, that also collects the label ...


group ([1,2,3], [1,2,3], [1,2,3], "label")

to have 3 points: (1,1,1), (2,2,2) and (3,3,3).

right?

it is the same to have, in C

struct series {
CpLabel * label; /* stores label and label plot characteristics */
void *data ; /* multi-dimension array of data */
}

it could also store some other series settings, like color (or color
theme, or color effect)

what information does series have, and can we store the data in a
multi-dimensional void array?

Lucas Hermann Negri

unread,
Jul 7, 2009, 1:05:47 PM7/7/09
to cair...@googlegroups.com
What label does series->label ref? For example, in a BarPlot, it would
be the vertical label, horizontal label, or the legend label? I think
it makes more sense to be the legend label, but I think that we should
handle legends in a separated way.
--
http://oproj.tuxfamily.org

Lucas Hermann Negri

unread,
Jul 7, 2009, 3:03:37 PM7/7/09
to cair...@googlegroups.com
Status:

Classes:

-> LabelList (100%) -- Holds a list of labels, with the size, angle
and color property.

-> Plot (10%) -- Abstract. Draws the background, bounding box and other tasks.
-> BarPlot (10%) -- Draws a vertical or horizontal plot.

-> Handler (100%) -- Abstract. Handles the plot surface and cairo context.
-> PNGHandler (100%) -- For PNG output.

Boxed types:

-> Color (100%) -- Represents a RGBA color;

Next step is to implement a series data type and the BarPlot class.
--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 7, 2009, 3:20:25 PM7/7/09
to cair...@googlegroups.com
By series, i mean data->attached label, example

people that jumped (title)
luis 70
Lucas 10
^^ this label makes part of the series.

other generated labels have to be handled other way.

Luis Matos

unread,
Jul 7, 2009, 3:22:06 PM7/7/09
to cair...@googlegroups.com
Ter, 2009-07-07 às 16:03 -0300, Lucas Hermann Negri escreveu:
> Status:
>
> Classes:
>
> -> LabelList (100%) -- Holds a list of labels, with the size, angle
> and color property.
>
> -> Plot (10%) -- Abstract. Draws the background, bounding box and other tasks.
> -> BarPlot (10%) -- Draws a vertical or horizontal plot.
>
> -> Handler (100%) -- Abstract. Handles the plot surface and cairo context.
> -> PNGHandler (100%) -- For PNG output.
>
> Boxed types:
>
> -> Color (100%) -- Represents a RGBA color;

You still don't have a handler for color themes. ( several colors ) .
I have a gradient function in my code and a typedef (ok, not working) of
a color theme type, using glist. but glist can be replaced by a CpColor
pointer.

Magnun Leno

unread,
Jul 7, 2009, 3:42:49 PM7/7/09
to cair...@googlegroups.com
Hello CairoPlot Dev Team,

    Before anything I suggest to start a new thread since this one is going a little off-topic (port to lua) :)

    Since I've developed the Series module with Rodrigo I'll give a word about it! The series module is composed by 4 types of object: Serie, Group, Data and Colors.
  • The Data type is the smallest part of a Serie, it can represent a a single number (int, float or long) or a list of numbers that can represent a point (2D or 3D). The Data type also has a name, witch can be empty. We've decided to make it this way 'couse Rodrigo plan to implement in a near future (I hope) the point label in the ScatterPlot.
  • The Group type is composed by a list of points and also has a name, but this one can't be empty. If the group name is not provided it is generated based in it's group index in the Serie. The Group data also has a range attribute witch is a list of numbers and defines the x axis in case of using a lambda to define a group.
  • The Serie type is defined as a list of Groups, a name, a range and a set of colors. It's name can be empty, and will be used in the futures as the plot title. The range of the Serie is used when you wand to have a group of lambdas within the same range. All the groups in this Serie will look for this range if the Group range is empty.
  • The Colors is really experimental in the Series module and is basically a list of numbers and a string defining the rendering of the colour (linear, solid or gradient).
    Rodrigo and I was talking about moving all the 'commom plot attributes' to the Series class. So attributes like background, border, width, height, x labels, y labels, x axis, y axis... would be defined inside the Series class and the specific plot attributes would be passed as argument in the plot function, like rounded corners (for bar plot), inner radius (for donut plot), discrete (for function plot)...

    I was planning to help coding but when I looked the source code I felt really dumb!! Does anyone has a good on line document about using the glib.h?? I've never used it... I think I can be useful (or not).

Thanks in advance...
Magnun Leno


On Tue, Jul 7, 2009 at 11:05 AM, <ga...@otiliamatos.ath.cx> wrote:

Lucas Hermann Negri

unread,
Jul 7, 2009, 4:02:55 PM7/7/09
to cair...@googlegroups.com
Luis Matos:

About the serie: I got it now. About the background: it can be
implemented in the future, since it's not a dependency for anything
else. I think we should focus on the basic things first.

Magnun Leno:

Good explanation. I think that I've understood it.
There's a tutorial in the GObject reference (
http://library.gnome.org/devel/gobject/stable/pt02.html ) . It's
somewhat complicated, but all makes sense at least =).

The biggest issue that I'm having is to represent data. In Lua and
Python it's easy to declare data types, but in C usually it needs
custom structs and a painful memory management. Also, the interface
must be good for both C users or by bindings, so it's not so simple
=(.

I will work on some other things now like label drawing and leave the
plot data structure definition for you guys.

--
http://oproj.tuxfamily.org

Luis Matos

unread,
Jul 7, 2009, 4:06:18 PM7/7/09
to cair...@googlegroups.com
Hello!

i suggest devhelp! It is a good documentation tool (to view). Check
GObject. glib is like the standard c headers, but with memory protection
(g_malloc, g_printf), but with extended tools, like glist (pointer
double referenced list).

The code does not have ANY comment, so it is hard to understand.

About the series, i think we are all talking about the same:

series have:
labels (for the serie, font, position, size, orientation, label color)
labels (for the points, font, position, size, orientation)
data (1D, #D, whatever)
colors (color array), and maybe type of color print (solid,
gradient .. )

right?

about the offtopic ... i think that, to History, we should continue
here.

Luis Matos



Ter, 2009-07-07 às 16:42 -0300, Magnun Leno escreveu:
> Hello CairoPlot Dev Team,
>
> Before anything I suggest to start a new thread since this one is
> going a little off-topic (port to lua) :)
>
> Since I've developed the Series module with Rodrigo I'll give a
> word about it! The series module is composed by 4 types of object:
> Serie, Group, Data and Colors.
> * The Data type is the smallest part of a Serie, it can
> represent a a single number (int, float or long) or a list of
> numbers that can represent a point (2D or 3D). The Data type
> also has a name, witch can be empty. We've decided to make it
> this way 'couse Rodrigo plan to implement in a near future (I
> hope) the point label in the ScatterPlot.
> * The Group type is composed by a list of points and also has a
> name, but this one can't be empty. If the group name is not
> provided it is generated based in it's group index in the
> Serie. The Group data also has a range attribute witch is a
> list of numbers and defines the x axis in case of using a
> lambda to define a group.
> * The Serie type is defined as a list of Groups, a name, a range
> and a set of colors. It's name can be empty, and will be used
> in the futures as the plot title. The range of the Serie is
> used when you wand to have a group of lambdas within the same
> range. All the groups in this Serie will look for this range
> if the Group range is empty.
> * The Colors is really experimental in the Series module and is

Lucas Hermann Negri

unread,
Jul 7, 2009, 4:14:38 PM7/7/09
to cair...@googlegroups.com
Magnun Leno:

Using your data definition, in a BarPlot with 3 groups (let it be
March, April and June), each group formed by two bars (nº of sold
items, nº of bought items), we should have:

[group1, group2, group3], where

group1 = [1, 2] + label("March")
group2 = [3, 2] + label("April")
group3 = [2, 3] + label("June")

right?

So how do express the vertical labels, since they depend of the bar
values for a good layout.

X X
X X X X X
X X X X X X
group1 group2 gruop3

--
http://oproj.tuxfamily.org

Magnun Leno

unread,
Jul 7, 2009, 4:55:29 PM7/7/09
to cair...@googlegroups.com
Lucas,

  An example (in python) of what should be:

>>> import cairoplot
>>> import Series
>>> series = Series.Series({"March":[1,2], "April":[3,2], "June":[2,3]}, "Three Months Graph")
>>> cairoplot.vertical_bar_plot ( 'month_bars.svg', series, 400, 300, border=20,)

   and the output should be a graphic like this:
 __________________________
|  | Three Months Graph |  |
|  |____________________|  |

|                          |
|           X        X     |
|      X    X X    X X     |
|    X X    X X    X X     |     
|   March  April  June     |
|__________________________|

   The idea is that each group is a group of bars and it's names is the x labels. The data name (if specified) could be used to explain each bar (sold and bought), but it wasn't defined yet. Currently, not event the x_labels is being ploted based in the Series contents 'couse it was a planned feature to CairoPlot 2.0 which would probably break the retrocompatibility.
   Rodrigo was working on the labels layout, I suggested that it was a little sloped, maybe 45 degrees.

    Thanks for the links, I'll take a deep dive into it!
Magnun Leno

Magnun Leno

unread,
Jul 7, 2009, 5:08:06 PM7/7/09
to cair...@googlegroups.com
It wasn't officially announced yet, but CairoPlot has a IRC channel at irc.freenode.net, #cairoplot (thanks to Felipe Sanches). Maybe would be a nice place to discuss and settle some ideas.

Att,
Magnun Leno

Rodrigo Araújo

unread,
Jul 7, 2009, 5:12:44 PM7/7/09
to cair...@googlegroups.com
I agree with Magnun.
We should have an irc meeting so we can discuss and settle. That way, we might share our ideas for the future and point the development on the right direction.

What time are you available?
For me, it's ok anyday at night.

Att,
Rodrigo Araújo
Reply all
Reply to author
Forward
0 new messages