next up previous contents index
Next: QTclVtkWidget Up: Programming Previous: QDrawWidget   Contents   Index


QwtPlotWidget

QwtWidget is inserted in Qt Designer. This widget is comfortable for drawing xy-diagrams. For all commands see the reference.

Figure 6.15: Drawing a diagram in QwtPlotWidget
// outline
qpwEnableOutline(p,wtPlot1,1);
qpwSetOutlinePen(p,wtPlot1,GREEN);

// legend
qpwSetAutoLegend(p,wtPlot1,1);
qpwEnableLegend(p,wtPlot1,1);
qpwSetLegendPos(p,wtPlot1,0);
qpwSetLegendFrameStyle(p,wtPlot1,Box|Sunken);

// axes
qpwSetAxisTitle(p,wtPlot1,xBottom, "Normalized Frequency");
qpwSetAxisTitle(p,wtPlot1,yLeft, "Amplitude");

// curves
qpwInsertCurve(p,wtPlot1,0,"Sinus");
qpwSetCurvePen(p,wtPlot1,0,YELLOW,3,DashDotLine);
qpwSetCurveYAxis(p,wtPlot1,0,yLeft);
qpwSetCurveData(p,wtPlot1,0,100,xa,ya);
qpwReplot(p,wtPlot1);

Figure 6.16: Using lines in script languages
<?php
pvXYAllocate($p, 100);
for($i=0; $i<100; $i++)
{
  $x = ($i * 2.0 * 3.414) / 100.0;
  $y = sin($x);
  pvSetXY($p, $i, $x, $y);
}
qpwEnableOutline($p,$this->statistik,1);
qpwSetOutlinePen($p,$this->statistik,0,255,0);
qpwInsertCurve($p,$this->statistik,0,"");
qpwSetCurvePen($p,$this->statistik,0,255,255,0,3,SolidLine);
qpwSetCurveYAxis($p,$this->statistik,0,yLeft);
qpwSetBufferedCurveData($p, $this->statistik, 0);
qpwReplot($p,$this->statistik);
?>



Rainer Lehrig 2004-02-17