Navigation:  Welcome to GRAPH-XT > Getting Started >

Getting Started with Bar Chart Plots

 

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text

lampe

Info: A very detailed example for bar chart plots can be found in the DPlot_example1.prg example program, see SUB Dplot_barchart.

 

The following chapter shows how to create a simple bar chart plot like this:

clip0040

 

hmtoggle_plus1Create a new document

Doc_num=FNDplot_doc_new(0)      ! create new document

 

hmtoggle_plus1Create the point pairs and store them into a 2D REAL array

Xmin=0

Xmax=PI

Xpoints=50

Xstep=Xmax/Xpoints

ALLOCATE REAL Datxy(1:Xpoints,1:2)   ! 2-dimensional array

Xi=BASE(Datxy,1)

FOR X=Xmin TO Xmax STEP Xstep

   Datxy(Xi,1)=X                     ! x value bar chart curve 1

   Datxy(Xi,2)=ABS(SIN(X))           ! y value bar chart curve 1

   IF Xi<Xpoints THEN Xi=Xi+1

NEXT X

 

hmtoggle_plus1Send the data points to DPlot

! transfer all data points to DPlot curve 1, line type 1

Dummy=FNDplot_xyz_data(Doc_num,Datxy(*),0,0,1,"y=sin(x)  {0<x<PI}",1)

 

hmtoggle_plus1Create the bar chart plot

Dummy=FNDplot_send_cmd("[Scale(9)]")   ! create bar chart plot

 

hmtoggle_plus1Some tweaking

Dummy=FNDplot_send_cmd("[Legend(1,""y=sin(x)  {0<x<PI}"")]")

Dummy=FNDplot_send_cmd("[FillStyle(1,1)]")     ! Fill style for curve 1 = solid

Dummy=FNDplot_send_cmd("[Color(1,0,128,0)]")   ! curve 1 = dark green

Dummy=FNDplot_send_cmd("[ManualScale(,0,,1.1)]") ! manual scale of y axis

 

hmtoggle_plus1Show the bar chart plot on the HTBasic screen and close the document

CALL Dplot_show(Doc_num)             ! show the diagram, 100% screen size

Dummy=FNDplot_doc_close(Doc_num)     ! close the document