1
/****************************************************************************
2
** Copyright (C) 2006 Klarälvdalens Datakonsult AB. All rights reserved.
4
** This file is part of the KD Chart library.
6
** This file may be used under the terms of the GNU General Public
7
** License versions 2.0 or 3.0 as published by the Free Software
8
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
9
** included in the packaging of this file. Alternatively you may (at
10
** your option) use any later version of the GNU General Public
11
** License if such license has been publicly approved by
12
** Klarälvdalens Datakonsult AB (or its successors, if any).
14
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
15
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
16
** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
17
** not expressly granted herein.
19
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22
**********************************************************************/
24
#include <QApplication>
25
#include <KDChartWidget>
26
#include <KDChartLineDiagram>
27
#include <KDChartDataValueAttributes>
31
using namespace KDChart;
33
int main( int argc, char** argv ) {
34
QApplication app( argc, argv );
37
widget.resize( 600, 600 );
39
QVector< double > vec0, vec1, vec2;
41
vec0 << 5 << 1 << 3 << 4 << 1;
42
vec1 << 3 << 6 << 2 << 4 << 8;
43
vec2 << 2 << 7 << 1 << 2 << 1;
45
widget.setDataset( 0, vec0, "vec0" );
46
widget.setDataset( 1, vec1, "vec1" );
47
widget.setDataset( 2, vec2, "vec2" );
49
widget.lineDiagram()->setPen( Qt::NoPen );
51
DataValueAttributes dva( widget.lineDiagram()->dataValueAttributes() );
52
MarkerAttributes ma( dva.markerAttributes() );
53
TextAttributes ta( dva.textAttributes() );
54
ma.setVisible( true );
55
// display values or not
56
ta.setVisible( false );
57
dva.setTextAttributes( ta );
58
dva.setMarkerAttributes( ma );
59
dva.setVisible( true );
61
widget.lineDiagram()->setDataValueAttributes( dva );
62
widget.setGlobalLeading( 10, 10, 10, 10 );