]> git.cworth.org Git - acre/log
acre
10 years agoAdd another dataset style: ACRE_STYLE_BARS master
Carl Worth [Sat, 9 Nov 2013 20:40:31 +0000 (12:40 -0800)]
Add another dataset style: ACRE_STYLE_BARS

This is a mode to draw a dataset unconditionally as a bar chart,
(unlike BARS_OR_LINE which will use BARS when zoomed in sufficiently
or LINE when zoomed out).

10 years agoAdd a new BARS_OR_LINE style for drawing data sets.
Carl Worth [Sat, 9 Nov 2013 00:16:44 +0000 (16:16 -0800)]
Add a new BARS_OR_LINE style for drawing data sets.

If there is sufficient room, this will draw the dataset as a bar
chart. But if the bars would run into each other, it will draw as a
line chart instead.

10 years agoAdd support for a new TIMELINE style for drawing a data-set.
Carl Worth [Thu, 7 Nov 2013 21:24:30 +0000 (13:24 -0800)]
Add support for a new TIMELINE style for drawing a data-set.

For the TIMELINE style, each (X,Y) pair represents (start,stop) time
in the X dimension for a timeline bar to be drawn. The recently added
"_named" variant of add_data is also useful for supplying a name to be
drawn on the bar.

With multiple timelines within a chart, each one is positioned at a
different integer position along the Y axis, (and the Y axis range
computation is changed to preserve this).

There's only minimal cleverness to avoid collision of timeline label,
(the vertical position is cycled unconditionally).

More clever approaches would not change the vertical position if there
is no possibility of conflict, and would also reset to the top
position as soon as possible.

Other potential improvements to the TIMELINE style include:

  * Ensuring that a timeline label is visible whenever any portion of
    a timeline bar is visible.

  * Eliminating the rendering of numbers and ticks on the Y axis.

10 years agoForce an identity matrix when creating a pango layout
Carl Worth [Thu, 7 Nov 2013 21:22:00 +0000 (13:22 -0800)]
Force an identity matrix when creating a pango layout

I've been seeing strange effects in the font rendering when zooming in
dramatically. Inter-character and inter-word spacing was becoming
radically large or radically close to zero, (with overlapping
characters, etc.).

I assume the problem has something to do with numbers outside the
representable range of Pango's fixed-width implementation, (see "pango
units"). Simply setting an identity matrix before creating the layout
and selecting the font clears up all problems that I have seen so far.

10 years agoFix 0.0 value on axis to be 0.0.
Carl Worth [Thu, 7 Nov 2013 21:19:39 +0000 (13:19 -0800)]
Fix 0.0 value on axis to be 0.0.

I recently saw cases where the %g format was cauing a value that
should be 0.0 on the axis to appear as something insane like 5.58e-17.

If the value is within a thousandth of a sub-step, (a sub-step is the
space between two minor ticks on the axis), of 0.0 then force it to be
truly 0.0.

10 years agoacre-x: Fix zooming so that zoom-in and zoom-out use the same amounts
Carl Worth [Thu, 7 Nov 2013 21:14:56 +0000 (13:14 -0800)]
acre-x: Fix zooming so that zoom-in and zoom-out use the same amounts

The intent was always that one zoom-in followed by one zoom-out, (or
vice versa) would lead to the original zoom level. But the zoom-out
code had some incorrect arithmetic in it such that zooming out was
much faster than zooming in.

10 years agoacre-x: Don't redraw for unrecognized keypresses.
Carl Worth [Thu, 7 Nov 2013 21:13:22 +0000 (13:13 -0800)]
acre-x: Don't redraw for unrecognized keypresses.

Until we add double-buffering, any unnecessary redrawing causes
annoying blinking. Eliminating redraws from unknown keypresses fixes
at least some, (but likely not that many).

10 years agoAdd the notion of a style for each data set.
Carl Worth [Thu, 7 Nov 2013 17:48:53 +0000 (09:48 -0800)]
Add the notion of a style for each data set.

There's no real change here yet, since the only style offered so far
is the default ACRE_STYLE_LINE, (which is the same as how acre has
always drawn things). But things will get more interesting as new
styles are added in the future.

10 years agoAdd new add_data_point_2d_named
Carl Worth [Thu, 7 Nov 2013 17:39:16 +0000 (09:39 -0800)]
Add new add_data_point_2d_named

Nothing is actually done with the names yet, but this will be useful
when we add new timeline-like rendering modes for data sets.

10 years agoAdd xstrdup
Carl Worth [Thu, 7 Nov 2013 17:38:53 +0000 (09:38 -0800)]
Add xstrdup

Which is analagous to xmalloc and friends.

10 years agoClose up some memory leaks.
Carl Worth [Thu, 7 Nov 2013 17:25:46 +0000 (09:25 -0800)]
Close up some memory leaks.

Thanks to valgrind for catching these, of course.

10 years agoInitialize colors_size.
Carl Worth [Thu, 7 Nov 2013 17:25:16 +0000 (09:25 -0800)]
Initialize colors_size.

Valgrind caught this read of an uninitialized value.

10 years agoacre-x: Allow Escape key to quit
Carl Worth [Thu, 7 Nov 2013 13:34:11 +0000 (05:34 -0800)]
acre-x: Allow Escape key to quit

I kept finding myself having trouble quitting because I was hitting
Escape rather than Q. Make the program conform to my expectations.

10 years agoCompile with debugging symbols
Carl Worth [Thu, 7 Nov 2013 13:33:41 +0000 (05:33 -0800)]
Compile with debugging symbols

Because we always want them, of course.

10 years agoSilence pango warning if X or Y-axis label is unset.
Carl Worth [Thu, 7 Nov 2013 13:32:32 +0000 (05:32 -0800)]
Silence pango warning if X or Y-axis label is unset.

Pango emits an annoying warning if we pass it a NULL string, (though
it seems to do the right thing regardless). Quiet it down by passing
it an empty string instead.

10 years agoUpdate .gitignore
Carl Worth [Thu, 7 Nov 2013 04:35:24 +0000 (20:35 -0800)]
Update .gitignore

To ignore new acre-x binary (and temporary files).

10 years agoZoom and pan a bit less with each keypress
Carl Worth [Thu, 7 Nov 2013 04:34:43 +0000 (20:34 -0800)]
Zoom and pan a bit less with each keypress

This makes it a bit smoother and less jumpy for better control.

10 years agoAdd interactive zooming and panning.
Carl Worth [Thu, 7 Nov 2013 04:27:55 +0000 (20:27 -0800)]
Add interactive zooming and panning.

Left and right to pan, plus and minus to zoom, and Home to return to
full data range.

10 years agoAdd a simple X-based demo program
Carl Worth [Thu, 7 Nov 2013 04:09:48 +0000 (20:09 -0800)]
Add a simple X-based demo program

This is the same chart as in acre-test, but in an interactive program
using Xlib and cairo.

So far, the only interactivity is that it redraws the chart to match
any changes to window size.

10 years agoDrop the "tick avoidance" code.
Carl Worth [Thu, 7 Nov 2013 03:34:54 +0000 (19:34 -0800)]
Drop the "tick avoidance" code.

This didn't always work, (plotted lines could still run into the ticks
after zooming), so it just provided inconsistent padding around the
edges of the chart.

10 years agoDrop an unused function.
Carl Worth [Thu, 7 Nov 2013 03:32:43 +0000 (19:32 -0800)]
Drop an unused function.

This has been unused for several commits, and has just been annoying
me by triggering a compiler warning.

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.