chart.h
Go to the documentation of this file.
/*******************************************************
* Copyright (c) 2015-2019, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#pragma once
#include <fg/defines.h>
#include <fg/image.h>
#include <fg/plot.h>
#include <fg/surface.h>
#include <fg/vector_field.h>
#include <fg/histogram.h>
#ifdef __cplusplus
extern "C" {
#endif
FGAPI fg_err fg_create_chart(fg_chart *pHandle,
const fg_chart_type pChartType);
FGAPI fg_err fg_retain_chart(fg_chart* pOut, fg_chart pChart);
FGAPI fg_err fg_release_chart(fg_chart pHandle);
FGAPI fg_err fg_set_chart_axes_titles(fg_chart pHandle,
const char* pX,
const char* pY,
const char* pZ);
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);
FGAPI fg_err fg_set_chart_label_format(fg_chart pHandle, const char* pXFormat,
const char* pYFormat, const char* pZFormat);
FGAPI fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin, float* pZmax,
const fg_chart pHandle);
FGAPI fg_err fg_set_chart_legend_position(fg_chart pHandle, const float pX, const float pY);
FGAPI fg_err fg_append_image_to_chart(fg_chart pChart, fg_image pImage);
FGAPI fg_err fg_append_histogram_to_chart(fg_chart pChart, fg_histogram pHistogram);
FGAPI fg_err fg_append_plot_to_chart(fg_chart pChart, fg_plot pPlot);
FGAPI fg_err fg_append_surface_to_chart(fg_chart pChart, fg_surface pSurface);
FGAPI fg_err fg_append_vector_field_to_chart(fg_chart pChart, fg_vector_field pField);
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);
FGAPI fg_err fg_add_histogram_to_chart(fg_histogram* pHistogram, fg_chart pHandle,
const unsigned pNBins, const fg_dtype pType);
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);
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);
FGAPI fg_err fg_add_vector_field_to_chart(fg_vector_field* pField, fg_chart pHandle,
const unsigned pNPoints, const fg_dtype pType);
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);
FGAPI fg_err fg_get_chart_type(fg_chart_type *pChartType, const fg_chart pChart);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
namespace forge
{
class Chart {
private:
fg_chart mValue;
public:
FGAPI Chart(const ChartType cType);
FGAPI Chart(const Chart& pOther);
FGAPI ~Chart();
FGAPI void setAxesTitles(const char* pX,
const char* pY,
const char* pZ=NULL);
FGAPI void setAxesLimits(const float pXmin, const float pXmax,
const float pYmin, const float pYmax,
const float pZmin=0, const float pZmax=0);
FGAPI void setAxesLabelFormat(const char* pXFormat,
const char* pYFormat = "%4.1f",
const char* pZFormat = "%4.1f");
FGAPI void getAxesLimits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin = NULL, float* pZmax = NULL);
FGAPI void setLegendPosition(const float pX, const float pY);
FGAPI void add(const Image& pImage);
FGAPI void add(const Histogram& pHistogram);
FGAPI void add(const Plot& pPlot);
FGAPI void add(const Surface& pSurface);
FGAPI void add(const VectorField& pVectorField);
FGAPI Image image(const unsigned pWidth, const unsigned pHeight,
const ChannelFormat pFormat=FG_RGBA, const dtype pDataType=f32);
FGAPI Histogram histogram(const unsigned pNBins, const dtype pDataType);
FGAPI Plot plot(const unsigned pNumPoints, const dtype pDataType,
const PlotType pPlotType=FG_PLOT_LINE, const MarkerType pMarkerType=FG_MARKER_NONE);
FGAPI Surface surface(const unsigned pNumXPoints, const unsigned pNumYPoints, const dtype pDataType,
const PlotType pPlotType=FG_PLOT_SURFACE, const MarkerType pMarkerType=FG_MARKER_NONE);
FGAPI VectorField vectorField(const unsigned pNumPoints, const dtype pDataType);
FGAPI void render(const Window& pWindow,
const int pX, const int pY, const int pVPW, const int pVPH) const;
FGAPI fg_chart get() const;
FGAPI ChartType getChartType() const;
};
}
#endif
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::get
FGAPI fg_chart get() const
Get the handle to internal implementation of Chart.
forge::Chart::~Chart
FGAPI ~Chart()
Chart destructor.
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.
forge::Chart::getAxesLimits
FGAPI void getAxesLimits(float *pXmin, float *pXmax, float *pYmin, float *pYmax, float *pZmin=NULL, float *pZmax=NULL)
Get axes data ranges.
forge::Chart::vectorField
FGAPI VectorField vectorField(const unsigned pNumPoints, const dtype pDataType)
Create and add an Vector Field 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.
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.
forge::Chart::setLegendPosition
FGAPI void setLegendPosition(const float pX, const float pY)
Set legend position for Chart.
forge::Chart::getChartType
FGAPI ChartType getChartType() const
Get the type of the chart.
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::Chart
FGAPI Chart(const Chart &pOther)
Chart copy constructor.
forge::Chart::setAxesTitles
FGAPI void setAxesTitles(const char *pX, const char *pY, const char *pZ=NULL)
Set axes titles for the chart.
forge::Chart::Chart
FGAPI Chart(const ChartType cType)
Creates a Chart object with given dimensional property.
forge::Chart::add
FGAPI void add(const VectorField &pVectorField)
Add an existing vector field object to the current chart.
forge::Chart::add
FGAPI void add(const Histogram &pHistogram)
Add an existing Histogram object to the current chart.
forge::Chart::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.
forge::Chart::histogram
FGAPI Histogram histogram(const unsigned pNBins, const dtype pDataType)
Create and add an Histogram object to the current chart.
forge::Chart::add
FGAPI void add(const Surface &pSurface)
Add an existing Surface object to the current chart.
forge::Chart::add
FGAPI void add(const Image &pImage)
Add an existing Image object to the current chart.
forge::Chart::add
FGAPI void add(const Plot &pPlot)
Add an existing Plot object to the current chart.
forge::Histogram
Histogram is a bar graph to display data frequencey.
Definition histogram.h:163
forge::Image
Image is plain rendering of an image over the window or sub-region of it.
Definition image.h:174
forge::Plot
Plot is a line graph to display two dimensional data.
Definition plot.h:198
forge::Surface
Surface is a graph to display three dimensional data.
Definition surface.h:163
forge::VectorField
VectorField is a line graph to display two dimensional data.
Definition vector_field.h:180
forge::Window
Window is where other objects such as Images, Plots etc.
Definition window.h:300
defines.h
FGAPI
#define FGAPI
Definition defines.h:28
fg_chart
void * fg_chart
Definition defines.h:42
fg_channel_format
fg_channel_format
Definition defines.h:108
FG_RGBA
@ FG_RGBA
Four(Red, Green, Blue & Alpha) channels.
Definition defines.h:113
fg_plot_type
fg_plot_type
Definition defines.h:160
FG_PLOT_SURFACE
@ FG_PLOT_SURFACE
Surface plot.
Definition defines.h:163
FG_PLOT_LINE
@ FG_PLOT_LINE
Line plot.
Definition defines.h:161
fg_marker_type
fg_marker_type
Definition defines.h:166
FG_MARKER_NONE
@ FG_MARKER_NONE
No marker.
Definition defines.h:167
fg_err
fg_err
Definition defines.h:49
fg_plot
void * fg_plot
Definition defines.h:45
fg_surface
void * fg_surface
Definition defines.h:46
fg_dtype
fg_dtype
Definition defines.h:150
fg_image
void * fg_image
Definition defines.h:43
fg_vector_field
void * fg_vector_field
Definition defines.h:47
fg_window
void * fg_window
Definition defines.h:40
fg_histogram
void * fg_histogram
Definition defines.h:44
fg_chart_type
fg_chart_type
Definition defines.h:117
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.
fg_append_plot_to_chart
FGAPI fg_err fg_append_plot_to_chart(fg_chart pChart, fg_plot pPlot)
Add an existing plot object to 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.
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.
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_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_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_retain_chart
FGAPI fg_err fg_retain_chart(fg_chart *pOut, fg_chart pChart)
Increase reference count for the chart resource.
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.
fg_release_chart
FGAPI fg_err fg_release_chart(fg_chart pHandle)
Destroy the chart object.
fg_append_vector_field_to_chart
FGAPI fg_err fg_append_vector_field_to_chart(fg_chart pChart, fg_vector_field pField)
Add an existing vector field object to chart.
fg_append_surface_to_chart
FGAPI fg_err fg_append_surface_to_chart(fg_chart pChart, fg_surface pSurface)
Add an existing surface object to chart.
fg_get_chart_type
FGAPI fg_err fg_get_chart_type(fg_chart_type *pChartType, const fg_chart pChart)
Render the type of a chart.
fg_append_image_to_chart
FGAPI fg_err fg_append_image_to_chart(fg_chart pChart, fg_image pImage)
Add an existing image object to chart.
fg_set_chart_label_format
FGAPI fg_err fg_set_chart_label_format(fg_chart pHandle, const char *pXFormat, const char *pYFormat, const char *pZFormat)
Set the format for display of axes labels in a chart.
fg_append_histogram_to_chart
FGAPI fg_err fg_append_histogram_to_chart(fg_chart pChart, fg_histogram pHistogram)
Add an existing histogram object to 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.
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.
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_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.
histogram.h
image.h
forge
Definition chart.h:305
forge::ChartType
fg_chart_type ChartType
Definition defines.h:182
forge::MarkerType
fg_marker_type MarkerType
Definition defines.h:186
forge::dtype
dtype
Definition defines.h:188
forge::f32
@ f32
Definition defines.h:193
forge::ChannelFormat
fg_channel_format ChannelFormat
Definition defines.h:181
forge::PlotType
fg_plot_type PlotType
Definition defines.h:185
plot.h
surface.h
vector_field.h