Translations:Development/Tutorials/Physical Simulation/82/en

From KDE TechBase
Revision as of 17:42, 19 July 2019 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

// For xy plot using KplotWidget

   this->xyPlot = xyPlot;						//set pointer
   xyPlot->setMinimumSize( 600, 600 );					//set minimum size in pixel
   xyData = new KPlotObject( Qt::red, KPlotObject::Lines, 2 );		//the data lines are drawn in red with thickness 2
   xyPlot->setLimits(0, 100, 0, 600);					//the data limits are 0 to 100 in the x-direction and 0 to 600 in the y-direction (initially we start at point 590)
   xyPlot->addPlotObject(xyData);					//assign the data pointer to the graph. From now on, if the data pointer contains data, it is plotted in the graph
   xyPlot->setBackgroundColor( QColor(240, 240, 240) );		//background: light shade of gray
   xyPlot->setForegroundColor( Qt::black );				//foreground: black
   xyPlot->axis( KPlotWidget::BottomAxis )->setLabel("Time [s]");	//set x-axis labeling
   xyPlot->axis( KPlotWidget::LeftAxis )->setLabel("Position [m]");    //set y-axis labeling

}