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)

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

// 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

}


This page was last edited on 19 July 2019, at 17:42. Content is available under Creative Commons License SA 4.0 unless otherwise noted.
-->