Forge: chart.h Source File

Forge

chart.h
Go to the documentation of this file.
1 /*******************************************************
2 * Copyright (c) 2015-2019, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10 #pragma once
11
12 #include <fg/defines.h>
13 #include <fg/image.h>
14 #include <fg/plot.h>
15 #include <fg/surface.h>
16 #include <fg/vector_field.h>
17 #include <fg/histogram.h>
18
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
36 FGAPI fg_err fg_create_chart(fg_chart *pHandle,
37 const fg_chart_type pChartType);
38
46 FGAPI fg_err fg_destroy_chart(fg_chart pHandle);
47
58 FGAPI fg_err fg_set_chart_axes_titles(fg_chart pHandle,
59 const char* pX,
60 const char* pY,
61 const char* pZ);
62
76 FGAPI fg_err fg_set_chart_axes_limits(fg_chart pHandle,
77 const float pXmin, const float pXmax,
78 const float pYmin, const float pYmax,
79 const float pZmin, const float pZmax);
80
94 FGAPI fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
95 float* pYmin, float* pYmax,
96 float* pZmin, float* pZmax,
97 const fg_chart pHandle);
110 FGAPI fg_err fg_set_chart_legend_position(fg_chart pHandle, const float pX, const float pY);
111
126 FGAPI fg_err fg_add_image_to_chart(fg_image* pImage, fg_chart pHandle,
127 const unsigned pWidth, const unsigned pHeight,
128 const fg_channel_format pFormat,
129 const fg_dtype pType);
130
142 FGAPI fg_err fg_add_histogram_to_chart(fg_histogram* pHistogram, fg_chart pHandle,
143 const unsigned pNBins, const fg_dtype pType);
144
160 FGAPI fg_err fg_add_plot_to_chart(fg_plot* pPlot, fg_chart pHandle,
161 const unsigned pNPoints, const fg_dtype pType,
162 const fg_plot_type pPlotType, const fg_marker_type pMarkerType);
163
179 FGAPI fg_err fg_add_surface_to_chart(fg_surface* pSurface, fg_chart pHandle,
180 const unsigned pXPoints, const unsigned pYPoints, const fg_dtype pType,
181 const fg_plot_type pPlotType, const fg_marker_type pMarkerType);
182
193 FGAPI fg_err fg_add_vector_field_to_chart(fg_vector_field* pField, fg_chart pHandle,
194 const unsigned pNPoints, const fg_dtype pType);
195
208 FGAPI fg_err fg_render_chart(const fg_window pWindow,
209 const fg_chart pChart,
210 const int pX, const int pY, const int pWidth, const int pHeight);
211
220 FGAPI fg_err fg_get_chart_type(const fg_chart_type *pChartType, const fg_chart pChart);
221
224 #ifdef __cplusplus
225 }
226 #endif
227
228
229 #ifdef __cplusplus
230
231 namespace forge
232 {
233
243 class Chart {
244 private:
245 fg_chart mValue;
246
247 public:
253 FGAPI Chart(const ChartType cType);
254
258 FGAPI Chart(const Chart& pOther);
259
263 FGAPI ~Chart();
264
272 FGAPI void setAxesTitles(const char* pX,
273 const char* pY,
274 const char* pZ=NULL);
275
286 FGAPI void setAxesLimits(const float pXmin, const float pXmax,
287 const float pYmin, const float pYmax,
288 const float pZmin=0, const float pZmax=0);
289
300 FGAPI void getAxesLimits(float* pXmin, float* pXmax,
301 float* pYmin, float* pYmax,
302 float* pZmin = NULL, float* pZmax = NULL);
303
313 FGAPI void setLegendPosition(const float pX, const float pY);
314
320 FGAPI void add(const Image& pImage);
321
327 FGAPI void add(const Histogram& pHistogram);
328
334 FGAPI void add(const Plot& pPlot);
335
341 FGAPI void add(const Surface& pSurface);
342
348 FGAPI void add(const VectorField& pVectorField);
349
360 FGAPI Image image(const unsigned pWidth, const unsigned pHeight,
361 const ChannelFormat pFormat=FG_RGBA, const dtype pDataType=f32);
362
370 FGAPI Histogram histogram(const unsigned pNBins, const dtype pDataType);
371
383 FGAPI Plot plot(const unsigned pNumPoints, const dtype pDataType,
384 const PlotType pPlotType=FG_PLOT_LINE, const MarkerType pMarkerType=FG_MARKER_NONE);
385
397 FGAPI Surface surface(const unsigned pNumXPoints, const unsigned pNumYPoints, const dtype pDataType,
398 const PlotType pPlotType=FG_PLOT_SURFACE, const MarkerType pMarkerType=FG_MARKER_NONE);
399
407 FGAPI VectorField vectorField(const unsigned pNumPoints, const dtype pDataType);
408
418 FGAPI void render(const Window& pWindow,
419 const int pX, const int pY, const int pVPW, const int pVPH) const;
420
424 FGAPI fg_chart get() const;
425
429 FGAPI ChartType getChartType() const;
430 };
431
432 }
433
434 #endif
forge::Chart::getChartType
FGAPI ChartType getChartType() const
Get the type of the chart.
forge::VectorField
VectorField is a line graph to display two dimensional data.
Definition: vector_field.h:170
fg_render_chart
FGAPI fg_err fg_render_chart(const fg_window pWindow, const fg_chart pChart, const int pX, const int pY, const int pWidth, const int pHeight)
Render the chart to given window.
forge::f32
Definition: defines.h:194
FG_RGBA
Four(Red, Green, Blue & Alpha) channels.
Definition: defines.h:113
fg_chart
void * fg_chart
Definition: defines.h:42
vector_field.h
fg_marker_type
fg_marker_type
Definition: defines.h:166
FG_MARKER_NONE
No marker.
Definition: defines.h:167
forge
Definition: chart.h:231
forge::Chart::setLegendPosition
FGAPI void setLegendPosition(const float pX, const float pY)
Set legend position for Chart.
forge::Chart::getAxesLimits
FGAPI void getAxesLimits(float *pXmin, float *pXmax, float *pYmin, float *pYmax, float *pZmin=NULL, float *pZmax=NULL)
Get axes data ranges.
fg_get_chart_type
FGAPI fg_err fg_get_chart_type(const fg_chart_type *pChartType, const fg_chart pChart)
Render the type of a chart.
forge::Chart::histogram
FGAPI Histogram histogram(const unsigned pNBins, const dtype pDataType)
Create and add an Histogram object to the current chart.
fg_plot_type
fg_plot_type
Definition: defines.h:160
fg_get_chart_axes_limits
FGAPI fg_err fg_get_chart_axes_limits(float *pXmin, float *pXmax, float *pYmin, float *pYmax, float *pZmin, float *pZmax, const fg_chart pHandle)
Get axes data ranges.
forge::Chart::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.
surface.h
fg_set_chart_axes_titles
FGAPI fg_err fg_set_chart_axes_titles(fg_chart pHandle, const char *pX, const char *pY, const char *pZ)
Set axes titles for the chart.
forge::dtype
dtype
Definition: defines.h:189
fg_channel_format
fg_channel_format
Definition: defines.h:108
forge::Plot
Plot is a line graph to display two dimensional data.
Definition: plot.h:188
fg_set_chart_axes_limits
FGAPI fg_err fg_set_chart_axes_limits(fg_chart pHandle, const float pXmin, const float pXmax, const float pYmin, const float pYmax, const float pZmin, const float pZmax)
Set axes data ranges.
fg_chart_type
fg_chart_type
Definition: defines.h:117
fg_vector_field
void * fg_vector_field
Definition: defines.h:47
fg_add_vector_field_to_chart
FGAPI fg_err fg_add_vector_field_to_chart(fg_vector_field *pField, fg_chart pHandle, const unsigned pNPoints, const fg_dtype pType)
Create and add an Vector Field object to the current chart.
fg_set_chart_legend_position
FGAPI fg_err fg_set_chart_legend_position(fg_chart pHandle, const float pX, const float pY)
Set legend position for Chart.
forge::Chart::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.
forge::Chart::add
FGAPI void add(const Image &pImage)
Add an existing Image object to the current chart.
FGAPI
#define FGAPI
Definition: defines.h:28
fg_surface
void * fg_surface
Definition: defines.h:46
forge::Chart::Chart
FGAPI Chart(const ChartType cType)
Creates a Chart object with given dimensional property.
defines.h
fg_add_histogram_to_chart
FGAPI fg_err fg_add_histogram_to_chart(fg_histogram *pHistogram, fg_chart pHandle, const unsigned pNBins, const fg_dtype pType)
Create and add an Histogram object to the current chart.
fg_plot
void * fg_plot
Definition: defines.h:45
forge::Chart::setAxesTitles
FGAPI void setAxesTitles(const char *pX, const char *pY, const char *pZ=NULL)
Set axes titles for the chart.
fg_image
void * fg_image
Definition: defines.h:43
fg_err
fg_err
Definition: defines.h:49
forge::Chart
Chart is base canvas where other plottable objects are rendered.
Definition: chart.h:243
FG_PLOT_SURFACE
Surface plot.
Definition: defines.h:163
forge::Surface
Surface is a graph to display three dimensional data.
Definition: surface.h:153
fg_add_image_to_chart
FGAPI fg_err fg_add_image_to_chart(fg_image *pImage, fg_chart pHandle, const unsigned pWidth, const unsigned pHeight, const fg_channel_format pFormat, const fg_dtype pType)
Create and add an Image object to the current chart.
fg_add_surface_to_chart
FGAPI fg_err fg_add_surface_to_chart(fg_surface *pSurface, fg_chart pHandle, const unsigned pXPoints, const unsigned pYPoints, const fg_dtype pType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create and add an Plot object to the current chart.
image.h
forge::Chart::~Chart
FGAPI ~Chart()
Chart destructor.
forge::Chart::vectorField
FGAPI VectorField vectorField(const unsigned pNumPoints, const dtype pDataType)
Create and add an Vector Field object to the current chart.
histogram.h
fg_destroy_chart
FGAPI fg_err fg_destroy_chart(fg_chart pHandle)
Destroy the chart object.
plot.h
forge::Image
Image is plain rendering of an image over the window or sub-region of it.
Definition: image.h:164
forge::Window
Window is where other objects such as Images, Plots etc.
Definition: window.h:296
fg_histogram
void * fg_histogram
Definition: defines.h:44
fg_window
void * fg_window
Definition: defines.h:40
FG_PLOT_LINE
Line plot.
Definition: defines.h:161
fg_create_chart
FGAPI fg_err fg_create_chart(fg_chart *pHandle, const fg_chart_type pChartType)
Create a Chart object with given dimensional property.
forge::Chart::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.
forge::Chart::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.
fg_dtype
fg_dtype
Definition: defines.h:150
forge::Chart::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.
fg_add_plot_to_chart
FGAPI fg_err fg_add_plot_to_chart(fg_plot *pPlot, fg_chart pHandle, const unsigned pNPoints, const fg_dtype pType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create and add an Plot object to the current chart.
forge::Histogram
Histogram is a bar graph to display data frequencey.
Definition: histogram.h:153