Forge

Public Member Functions
Chart Class Reference

Chart is base canvas where other plottable objects are rendered. More...

`#include <chart.h>`

## Public Member Functions
FGAPI | Chart (const ChartType cType)
| Creates a Chart object with given dimensional property. More...
FGAPI | Chart (const Chart &pOther)
| Chart copy constructor. More...
FGAPI | ~Chart ()
| Chart destructor. More...
FGAPI void | setAxesTitles (const char *pX, const char *pY, const char *pZ=NULL)
| Set axes titles for the chart. More...
FGAPI void | setAxesLimits (const float pXmin, const float pXmax, const float pYmin, const float pYmax, const float pZmin=0, const float pZmax=0)
| Set axes data ranges. More...
FGAPI void | setAxesLabelFormat (const char *pXFormat, const char *pYFormat="%4.1f", const char *pZFormat="%4.1f")
| Set the format for display of axes labels. More...
FGAPI void | getAxesLimits (float *pXmin, float *pXmax, float *pYmin, float *pYmax, float *pZmin=NULL, float *pZmax=NULL)
| Get axes data ranges. More...
FGAPI void | setLegendPosition (const float pX, const float pY)
| Set legend position for Chart. More...
FGAPI void | add (const Image &pImage)
| Add an existing Image object to the current chart. More...
FGAPI void | add (const Histogram &pHistogram)
| Add an existing Histogram object to the current chart. More...
FGAPI void | add (const Plot &pPlot)
| Add an existing Plot object to the current chart. More...
FGAPI void | add (const Surface &pSurface)
| Add an existing Surface object to the current chart. More...
FGAPI void | add (const VectorField &pVectorField)
| Add an existing vector field object to the current chart. More...
FGAPI Image | image (const unsigned pWidth, const unsigned pHeight, const ChannelFormat pFormat=FG_RGBA, const dtype pDataType=f32)
| Create and add an Image object to the current chart. More...
FGAPI Histogram | histogram (const unsigned pNBins, const dtype pDataType)
| Create and add an Histogram object to the current chart. More...
FGAPI Plot | plot (const unsigned pNumPoints, const dtype pDataType, const PlotType pPlotType=FG_PLOT_LINE, const MarkerType pMarkerType=FG_MARKER_NONE)
| Create and add an Plot object to the current chart. More...
FGAPI Surface | surface (const unsigned pNumXPoints, const unsigned pNumYPoints, const dtype pDataType, const PlotType pPlotType=FG_PLOT_SURFACE, const MarkerType pMarkerType=FG_MARKER_NONE)
| Create and add an Plot object to the current chart. More...
FGAPI VectorField | vectorField (const unsigned pNumPoints, const dtype pDataType)
| Create and add an Vector Field object to the current chart. More...
FGAPI void | render (const Window &pWindow, const int pX, const int pY, const int pVPW, const int pVPH) const
| Render the chart to given window. More...
FGAPI fg_chart | get () const
| Get the handle to internal implementation of Chart. More...
FGAPI ChartType | getChartType () const
| Get the type of the chart. More...

## Detailed Description

Chart is base canvas where other plottable objects are rendered.

Charts come in two types:

- FG_CHART_2D - Two dimensional charts
- FG_CHART_3D - Three dimensional charts

Examples:
  cpu/bubblechart.cpp, cpu/field.cpp, cpu/histogram.cpp, cpu/plot3.cpp, cpu/plotting.cpp, cpu/stream.cpp, cpu/surface.cpp, opencl/bubblechart.cpp, opencl/field.cpp, opencl/histogram.cpp, opencl/plot3.cpp, opencl/plotting.cpp, opencl/stream.cpp, and opencl/surface.cpp.

## Constructor & Destructor Documentation

## ◆ Chart() [1/2]

FGAPI Chart | ( | const ChartType | cType | ) |

Creates a Chart object with given dimensional property.

Parameters

  [in] | cType | is chart dimension property

## ◆ Chart() [2/2]

FGAPI Chart | ( | const Chart & | pOther | ) |

Chart copy constructor.

## ◆ ~Chart()

FGAPI ~Chart | ( |  | ) |

Chart destructor.

## Member Function Documentation

## ◆ add() [1/5]

FGAPI void add | ( | const Image & | pImage | ) |

Add an existing Image object to the current chart.

Parameters

  [in] | pImage | is the Image to render on the chart

## ◆ add() [2/5]

FGAPI void add | ( | const Histogram & | pHistogram | ) |

Add an existing Histogram object to the current chart.

Parameters

  [in] | pHistogram | is the Histogram to render on the chart

## ◆ add() [3/5]

FGAPI void add | ( | const Plot & | pPlot | ) |

Add an existing Plot object to the current chart.

Parameters

  [in] | pPlot | is the Plot to render on the chart

## ◆ add() [4/5]

FGAPI void add | ( | const Surface & | pSurface | ) |

Add an existing Surface object to the current chart.

Parameters

  [in] | pSurface | is the Surface to render on the chart

## ◆ add() [5/5]

FGAPI void add | ( | const VectorField & | pVectorField | ) |

Add an existing vector field object to the current chart.

Parameters

  [in] | pVectorField | is the Surface to render on the chart

## ◆ get()

FGAPI fg_chart get | ( |  | ) | const

Get the handle to internal implementation of Chart.

## ◆ getAxesLimits()

FGAPI void getAxesLimits | ( | float * | pXmin,
|  | float * | pXmax,
|  | float * | pYmin,
|  | float * | pYmax,
|  | float * | pZmin = `NULL`,
|  | float * | pZmax = `NULL`
| ) |  |

Get axes data ranges.

Parameters

  [out] | pXmin | is x-axis minimum data value
  [out] | pXmax | is x-axis maximum data value
  [out] | pYmin | is y-axis minimum data value
  [out] | pYmax | is y-axis maximum data value
  [out] | pZmin | is z-axis minimum data value
  [out] | pZmax | is z-axis maximum data value

## ◆ getChartType()

FGAPI ChartType getChartType | ( |  | ) | const

Get the type of the chart.

## ◆ histogram()

FGAPI Histogram histogram | ( | const unsigned | pNBins,
|  | const dtype | pDataType
| ) |  |

Create and add an Histogram object to the current chart.

Parameters

  [in] | pNBins | is number of bins the data is sorted out
  [in] | pDataType | takes one of the values of dtype that indicates the integral data type of histogram data

## ◆ image()

FGAPI Image image | ( | const unsigned | pWidth,
|  | const unsigned | pHeight,
|  | const ChannelFormat | pFormat = `FG_RGBA`,
|  | const dtype | pDataType = `f32`
| ) |  |

Create and add an Image object to the current chart.

Parameters

  [in] | pWidth | Width of the image
  [in] | pHeight | Height of the image
  [in] | pFormat | Color channel format of image, uses one of the values of ChannelFormat
  [in] | pDataType | takes one of the values of dtype that indicates the integral data type of histogram data

## ◆ plot()

FGAPI Plot plot | ( | const unsigned | pNumPoints,
|  | const dtype | pDataType,
|  | const PlotType | pPlotType = `FG_PLOT_LINE`,
|  | const MarkerType | pMarkerType = `FG_MARKER_NONE`
| ) |  |

Create and add an Plot object to the current chart.

Parameters

  [in] | pNumPoints | is number of data points to display
  [in] | pDataType | takes one of the values of dtype that indicates the integral data type of plot data
  [in] | pPlotType | dictates the type of plot/graph, it can take one of the values of PlotType
  [in] | pMarkerType | indicates which symbol is rendered as marker. It can take one of the values of MarkerType.

## ◆ render()

FGAPI void render | ( | const Window & | pWindow,
|  | const int | pX,
|  | const int | pY,
|  | const int | pVPW,
|  | const int | pVPH
| ) |  | const

Render the chart to given window.

Parameters

  [in] | pWindow | is target window to where chart will be rendered
  [in] | pX | is x coordinate of origin of viewport in window coordinates
  [in] | pY | is y coordinate of origin of viewport in window coordinates
  [in] | pVPW | is the width of the viewport
  [in] | pVPH | is the height of the viewport

## ◆ setAxesLabelFormat()

FGAPI void setAxesLabelFormat | ( | const char * | pXFormat,
|  | const char * | pYFormat = `"%4.1f"`,
|  | const char * | pZFormat = `"%4.1f"`
| ) |  |

Set the format for display of axes labels.

Parameters

  [in] | pXFormat | sets the display format for numbers of X axis
  [in] | pYFormat | sets the display format for numbers of Y axis
  [in] | pZFormat | sets the display format for numbers of Z axis

Display format string follows printf style formating for numbers

## ◆ setAxesLimits()

FGAPI void setAxesLimits | ( | const float | pXmin,
|  | const float | pXmax,
|  | const float | pYmin,
|  | const float | pYmax,
|  | const float | pZmin = `0`,
|  | const float | pZmax = `0`
| ) |  |

Set axes data ranges.

Parameters

  [in] | pXmin | is x-axis minimum data value
  [in] | pXmax | is x-axis maximum data value
  [in] | pYmin | is y-axis minimum data value
  [in] | pYmax | is y-axis maximum data value
  [in] | pZmin | is z-axis minimum data value
  [in] | pZmax | is z-axis maximum data value

## ◆ setAxesTitles()

FGAPI void setAxesTitles | ( | const char * | pX,
|  | const char * | pY,
|  | const char * | pZ = `NULL`
| ) |  |

Set axes titles for the chart.

Parameters

  [in] | pX | is x-axis title label
  [in] | pY | is y-axis title label
  [in] | pZ | is z-axis title label

## ◆ setLegendPosition()

FGAPI void setLegendPosition | ( | const float | pX,
|  | const float | pY
| ) |  |

Set legend position for Chart.

Parameters

  [in] | pX | is horizontal position in normalized coordinates
  [in] | pY | is vertical position in normalized coordinates

Note
  By normalized coordinates, the range of these coordinates is expected to be [0-1]. (0,0) is the bottom hand left corner.

## ◆ surface()

FGAPI Surface surface | ( | const unsigned | pNumXPoints,
|  | const unsigned | pNumYPoints,
|  | const dtype | pDataType,
|  | const PlotType | pPlotType = `FG_PLOT_SURFACE`,
|  | const MarkerType | pMarkerType = `FG_MARKER_NONE`
| ) |  |

Create and add an Plot object to the current chart.

Parameters

  [in] | pNumXPoints | is number of data points along X dimension
  [in] | pNumYPoints | is number of data points along Y dimension
  [in] | pDataType | takes one of the values of dtype that indicates the integral data type of plot data
  [in] | pPlotType | is the render type which can be one of PlotType (valid choices are FG_PLOT_SURFACE and FG_PLOT_SCATTER)
  [in] | pMarkerType | is the type of MarkerType to draw for FG_PLOT_SCATTER plot type

## ◆ vectorField()

FGAPI VectorField vectorField | ( | const unsigned | pNumPoints,
|  | const dtype | pDataType
| ) |  |

Create and add an Vector Field object to the current chart.

Parameters

  [in] | pNumPoints | is number of data points to display
  [in] | pDataType | takes one of the values of dtype that indicates the integral data type of vector field data

The documentation for this class was generated from the following file:

- chart.h