]> git.cworth.org Git - acre/log
acre
10 years agoUse cairo_clip to trim out any out-of-view data
Carl Worth [Thu, 7 Nov 2013 03:30:28 +0000 (19:30 -0800)]
Use cairo_clip to trim out any out-of-view data

Previously, we were simply not drawing line segments where one
endpoint of the segment was outside the bounds of the chart. This had
the problem of omitting a (potentially large) portion of the line
segment that should be visible.

We get the correct result, and more easily, by simply calling
cairo_clip.

10 years agoAllow zooming in or out by setting ranges of data to be shown on either axis.
Carl Worth [Wed, 6 Nov 2013 23:33:54 +0000 (15:33 -0800)]
Allow zooming in or out by setting ranges of data to be shown on either axis.

The second axis can also be explicitly set to a desired range, or it
can be allowed to be automatically set to fit the data.

10 years agoKeep track of data ranges as data is added
Carl Worth [Wed, 6 Nov 2013 22:00:34 +0000 (14:00 -0800)]
Keep track of data ranges as data is added

This avoids the need to loop over the data to find its range just
before drawing. This is in preparation for code that will allow for a
custom viewing range (such as for zooming) rather than always
displaying all available data.

10 years agoAdd necessary -lm flag to link command
Carl Worth [Wed, 6 Nov 2013 21:27:10 +0000 (13:27 -0800)]
Add necessary -lm flag to link command

I don't know how this ever worked without this.

15 years agoUse CIE L*a*b colors instead of HSV
Carl Worth [Tue, 3 Feb 2009 16:45:01 +0000 (08:45 -0800)]
Use CIE L*a*b colors instead of HSV

This gives perceptually uniform colors, (rather than totally
different lightness as one gets with HSV---which is based on
RGB primaries).

Thanks to LittleCMS for the colorspace conversion.

15 years agoChange acre-test to have 3 dataset lines instead of 1.
Carl Worth [Tue, 3 Feb 2009 16:00:50 +0000 (08:00 -0800)]
Change acre-test to have 3 dataset lines instead of 1.

This allows us to see the results of the new color-selection code.

15 years agoSelect N colors from HSV color space.
Carl Worth [Tue, 3 Feb 2009 16:00:17 +0000 (08:00 -0800)]
Select N colors from HSV color space.

This is as opposed to the three hard-coded RGB primaries which
we had before.

15 years agoAdd a simple legend
Carl Worth [Tue, 27 Jan 2009 20:11:20 +0000 (12:11 -0800)]
Add a simple legend

We're now not missing any features that the original motorsim plot had.

15 years agoAdd some distinguishing colors for the datasets
Carl Worth [Tue, 27 Jan 2009 19:48:46 +0000 (11:48 -0800)]
Add some distinguishing colors for the datasets

This is quite cheesy for now. It's just three hard-coded, primary colors.
(Much nicer would be to take N evenly-spaced colors from a percpetually
linear space.) But this gives us parity with the functionality of the
original motorsim plot, so it's enough for getting us closer to being
able to replace that.

15 years agoShrink title font size a bit.
Carl Worth [Tue, 27 Jan 2009 19:43:53 +0000 (11:43 -0800)]
Shrink title font size a bit.

When comparing an acre-made plot to a similar motorsim plot,
it became clear that the acre title font was too large, (but
also the original motorsim title font was too small). Attempt
to find a happy medium.

15 years agoFix rounding when deciding between major and minor tick
Carl Worth [Tue, 27 Jan 2009 19:42:44 +0000 (11:42 -0800)]
Fix rounding when deciding between major and minor tick

We noticed that some charts were missing a major tick, (like
0, 0.5,  ,1.5, 2.0, 2.5). Fix this.

15 years agoAdjust axis ranges so data doesn't collide with ticks.
Carl Worth [Tue, 27 Jan 2009 17:57:35 +0000 (09:57 -0800)]
Adjust axis ranges so data doesn't collide with ticks.

There. I think I'm done making the ticks and frame look nice now.
I'm totally happy with the result.

15 years agoUse 4 minor divisions instead of 5 for major steps of 1 or 10
Carl Worth [Tue, 27 Jan 2009 16:49:22 +0000 (08:49 -0800)]
Use 4 minor divisions instead of 5 for major steps of 1 or 10

Otherwise there's no minor tick at the half-way point and that's
just not nice.

15 years agoFix pixel snapping for minor ticks
Carl Worth [Tue, 27 Jan 2009 16:24:56 +0000 (08:24 -0800)]
Fix pixel snapping for minor ticks

It's a tiny tweak to the axis-expansion code to get it to think about
minor ticks as well as major ticks.

15 years agoAdd minor ticks
Carl Worth [Tue, 27 Jan 2009 16:12:39 +0000 (08:12 -0800)]
Add minor ticks

For now, do 5 divisions of each major tick, regardless of whether the
major tick spacing is 1, 2.5, 5, or 10. Also, we don't yet fix the
axes to guarantee integer spacing of the minor ticks.

15 years agoRemove code duplication for X and Y ticks
Carl Worth [Tue, 27 Jan 2009 15:34:23 +0000 (07:34 -0800)]
Remove code duplication for X and Y ticks

I knew this code was repeated, and fortunately it wasn't as hard to
share it as I thought it might be. Adding minor-tick rendering will
be much easier now that this is shared.

15 years agoAccount for space between tick values and frames
Carl Worth [Tue, 27 Jan 2009 15:10:50 +0000 (07:10 -0800)]
Account for space between tick values and frames

With this correctly accounted for the axis labels now have consistent
padding above and below.

15 years agoChange test data to go all the way to 100
Carl Worth [Tue, 27 Jan 2009 08:55:42 +0000 (00:55 -0800)]
Change test data to go all the way to 100

This makes the value 100 appear along the X axis which just looks nicer.

15 years agoLeave sufficient space for Y-axis value labels
Carl Worth [Tue, 27 Jan 2009 08:55:08 +0000 (00:55 -0800)]
Leave sufficient space for Y-axis value labels

Things look much nicer now that the Y-axis label isn't crashing into
the value labels along the Y axis.

15 years agoAdd function to create a pango layout with a printf-style format string
Carl Worth [Tue, 27 Jan 2009 08:30:37 +0000 (00:30 -0800)]
Add function to create a pango layout with a printf-style format string

This eliminates a tiny bit of redundant code now, and then more in
the future.

15 years agoAdd code to cleanup PangoLayout objects when done with them
Carl Worth [Tue, 27 Jan 2009 08:21:19 +0000 (00:21 -0800)]
Add code to cleanup PangoLayout objects when done with them

We're still not even close to being leak free, but this is one
baby step on the way.

15 years agoAdd some value labels next to the ticks.
Carl Worth [Tue, 27 Jan 2009 08:11:35 +0000 (00:11 -0800)]
Add some value labels next to the ticks.

Not yet accounting for these when doing the chart layout, so
we'll still need to fix that obviously.

15 years agoEliminate some code duplication in the tick adjustment phase.
Carl Worth [Tue, 27 Jan 2009 07:23:25 +0000 (23:23 -0800)]
Eliminate some code duplication in the tick adjustment phase.

We were repeating calculations for X and Y that can just happen
once in _expand_range_for_width.

15 years agoFinish adjustment of tick positions for pixel-snapping.
Carl Worth [Tue, 27 Jan 2009 07:17:42 +0000 (23:17 -0800)]
Finish adjustment of tick positions for pixel-snapping.

This is the final step of adjusting the axis ranges so that
the ticks aligne nicely with integer pixel boundaries. Notably
we don't round the ticks at all while drawing them---instead
we only adjust the axis ranges so that when we draw the ticks
at their numerical positions they will look good.

15 years agoCleverly adjust axis ranges for integer tick spacing.
Carl Worth [Sun, 25 Jan 2009 17:30:50 +0000 (04:30 +1100)]
Cleverly adjust axis ranges for integer tick spacing.

This will help avoid one of my major pet peeves with chartting
packages, which is non-pixel-aligned ticks. This is part of
the problem solved, (integer spacing between ticks), but we
still need integer alignment.

15 years agoRemove bogus 0.5 offset when setting up data transform.
Carl Worth [Sun, 25 Jan 2009 16:46:16 +0000 (03:46 +1100)]
Remove bogus 0.5 offset when setting up data transform.

I think my intuition here had been to provide at least some padding
between the frame and data. But we should do that explicitly (and
correctly) rather than just throwing in a 0.5 offset.

15 years agoDraw major ticks along the X and Y axes.
Carl Worth [Sun, 25 Jan 2009 16:40:47 +0000 (03:40 +1100)]
Draw major ticks along the X and Y axes.

Many thanks to Keith Packard for suggesting the math to
normalize and choose a step spacing.

15 years agoAdd preliminary data plotting.
Carl Worth [Sun, 25 Jan 2009 09:42:38 +0000 (20:42 +1100)]
Add preliminary data plotting.

It's all in black for now, with no colors or styles.

Also, we don't yet have ticks nor axis value labels nor a key.

15 years agoPut frame and ticks into its own function as well.
Carl Worth [Sun, 25 Jan 2009 09:03:21 +0000 (20:03 +1100)]
Put frame and ticks into its own function as well.

15 years agoSplit drawing of title and labels into its own function.
Carl Worth [Sun, 25 Jan 2009 08:56:56 +0000 (19:56 +1100)]
Split drawing of title and labels into its own function.

This will make things much more clear as we now add functions
for drawing the chart outline, the ticks, and the data itself.

15 years agoDraw title and axis labels with pango
Carl Worth [Sun, 25 Jan 2009 08:48:28 +0000 (19:48 +1100)]
Draw title and axis labels with pango

Many thanks to Owen and Behdad for all the pango love.

The layout iterates if necessary do to any wrapping from overly long
title or axis labels.

15 years agoAdd preliminary implementation of acre
Carl Worth [Sun, 25 Jan 2009 07:18:49 +0000 (18:18 +1100)]
Add preliminary implementation of acre

This is a simple chart-drawing library using cairo. We will use
this to replace the image-magick and perl-using csv2png script,
(and then also use this to do interactive charts within a GUI).

15 years agoCreate README file
Carl Worth [Thu, 16 Apr 2009 18:32:06 +0000 (11:32 -0700)]
Create README file

Just need an initial commit to boostrap this repository.