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).
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
It will be easier to bind to other languages.
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?).
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.
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.
Are you going to commit the background and the color theme stuff also?
Luis Matos
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
Background can have one or multiple colors. right?
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?
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?
people that jumped (title)
luis 70
Lucas 10
^^ this label makes part of the series.
other generated labels have to be handled other way.
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.
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.
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