]> Git trees. - libqmvoc.git/commit
Internal changes to libkdeeduplot in preparation for implementing
authorJason Harris <kstars@30doradus.org>
Sat, 28 Oct 2006 00:04:44 +0000 (00:04 +0000)
committerJason Harris <kstars@30doradus.org>
Sat, 28 Oct 2006 00:04:44 +0000 (00:04 +0000)
commit74862b566ab11db2cded4401a43edcc21bd1a24e
tree1b8f5bb9b8aa1d49eb92c62e6dc491032b825d0c
parent225c8bdd565d2f42601320449966651d05b81203
Internal changes to libkdeeduplot in preparation for implementing
non-colliding labels.  Basically, I was looking at the code and
saw several things that needed to be improved.

+ Added a "BARS" type for KPlotObject, and removed the "POLYGON"
type.  "CURVES" type is now called "LINES".

+ A single KPlotObject can now be any combination of POINTS,
LINES, and BARS.  These enum items have bitmask values (1,2,4),
so you should be able to OR them together in the ctor, but I
haven't gotten that to work yet.  Instead you can set it to one
type in the ctor, and use the
setShowPoints(bool)/setShowLines(bool)/setShowBars(bool)
convenience functions.

+ There are many more point shapes available now: CIRCLE, LETTER,
TRIANGLE, SQUARE, PENTAGON, HEXAGON, ASTERISK, and STAR

+ Plot objects no longer have a Name property.  It's unnecessary with
the new labeling scheme.

+ There is no longer a LABEL object type.  Instead, you can
define a label for any data point by adding a string argument to
addPoint(), like so:

  KPlotWidget *pw = new KPlotWidget( parent );
  pw->setLimits( -0.1, 4.1, -0.1, 6.1 );

  KPlotObject *po = new KPlotObject( Qt::white, KPlotObject::POINTS, 5.0, KPlotObject::ASTERISK );
  po->addPoint( 1.0, 2.5, "Point A" );
  po->addPoint( 2.0, 4.7, "Point B" );
  po->addPoint( 3.0, 5.5, "Point C" );

  pw->addObject( po );
  pw->update();

+ There is no longer an enum for specifying line styles.
Instead, you can now define QPens and QBrushes for drawing
points, lines and bars.  This is much more flexible.

+ renamed mapToPoint() to toScreen()

+ I added a "tests" subdirectory which demonstrates the library.
Please have a look.

TODO: It looks like drawing an axis using secondary data limits
is not working.  The "Lines" demo in the tests directory should
show the angle in degrees along the top axis (the angle is shown
in radians on the bottom axis).

As I said, I haven't gotten the KPlotObject ctor to accept multiple PlotType values.  i.e., this works:

  KPlotObject( Qt::white, KPlotObject::POINTS, 2.0, KPlotObject::TRIANGLE )

but this doesn't:

  KPlotObject( Qt::white, KPlotObject::POINTS|KPlotObject::LINES, 2.0, KPlotObject::TRIANGLE )

I checked to see that the kdeedu module compiles with these changes
(other than kstars changes, I only had to make a few modifications to
kalzium/src/elementdataviewer.cpp and ktouch/src/ktouchstatistics.cpp;
check it out, I think you'll like the new API)

Comments?  Problems?  Suggestions?

CCMAIL: kde-edu@kde.org

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=599640
kdeeduplot/CMakeLists.txt
kdeeduplot/kplotobject.cpp
kdeeduplot/kplotobject.h
kdeeduplot/kplotwidget.cpp
kdeeduplot/kplotwidget.h
kdeeduplot/tests/CMakeLists.txt [new file with mode: 0644]
kdeeduplot/tests/testplot_main.cpp [new file with mode: 0644]
kdeeduplot/tests/testplot_widget.cpp [new file with mode: 0644]
kdeeduplot/tests/testplot_widget.h [new file with mode: 0644]