Small class to produce graph with Google chart in HTML.
This Class can produce several graph using google chart
Create Histogram graph
This code produce the graph above
x.add("colum1");
x.add("colum2");
x.add("colum3");
x.add("colum4");
x.add("colum5");
x.add("colum6");
yn.add("dataset1");
yn.add("dataset2");
yn.add("dataset3");
yn.add("dataset4");
y.add({2,3,5,6});
y.add({5,6,1,6});
y.add({2,1,6,9});
y.add({1,6,3,2});
y.add({3,3,0,6});
y.add({2,1,4,6});
options.
title = std::string(
"Example");
options.
yAxis = std::string(
"Y Axis");
options.
xAxis = std::string(
"X Axis");
options.
stype = std::string(
"bars");
options.
stypeext = std::string(
"{3: {type: 'line'}}");
cg.
write(
"gc_out_sc.html");
Small class to produce graph with Google chart in HTML.
void write(std::string file)
It write the graphs on file in html format using Google charts.
void AddHistGraph(openfpm::vector< Y > &y)
Add an histogram graph.
Implementation of 1-D std::vector like structure.
std::string xAxis
X axis name.
std::string title
Title of the chart.
std::string yAxis
Y axis name.
Create Lines
This code produce the graph above
x.add("colum1");
x.add("colum2");
x.add("colum3");
x.add("colum4");
x.add("colum5");
x.add("colum6");
y.add({0.10,0.20,0.19,0.22,0.195,0.215,0.35,0.34,0.36});
y.add({0.11,0.21,0.18,0.22,0.19,0.215,0.36,0.35,0.37});
y.add({0.12,0.22,0.21,0.23,0.215,0.225,0.35,0.34,0.36});
y.add({0.15,0.25,0.20,0.26,0.22,0.255,0.36,0.35,0.37});
y.add({0.09,0.29,0.25,0.30,0.26,0.295,0.35,0.34,0.36});
y.add({0.08,0.28,0.27,0.29,0.275,0.285,0.36,0.35,0.37});
options.
title = std::string(
"Example");
options.
yAxis = std::string(
"Y Axis");
options.
xAxis = std::string(
"X Axis");
cg.
write(
"gc_plot2_out.html");
void AddLinesGraph(openfpm::vector< X > &x, openfpm::vector< Y > &y, const GCoptions &opt)
Add a simple lines graph.
size_t lineWidth
Width of the line.
Create lines with different styles
This code produce the graph above
x.add("colum1");
x.add("colum2");
x.add("colum3");
x.add("colum4");
x.add("colum5");
x.add("colum6");
yn.add("line1");
yn.add("line2");
yn.add("interval");
yn.add("interval");
yn.add("interval");
yn.add("interval");
yn.add("line3");
yn.add("interval");
yn.add("interval");
y.add({0.10,0.20,0.19,0.22,0.195,0.215,0.35,0.34,0.36});
y.add({0.11,0.21,0.18,0.22,0.19,0.215,0.36,0.35,0.37});
y.add({0.12,0.22,0.21,0.23,0.215,0.225,0.35,0.34,0.36});
y.add({0.15,0.25,0.20,0.26,0.22,0.255,0.36,0.35,0.37});
y.add({0.09,0.29,0.25,0.30,0.26,0.295,0.35,0.34,0.36});
y.add({0.08,0.28,0.27,0.29,0.275,0.285,0.36,0.35,0.37});
options.
title = std::string(
"Example");
options.
yAxis = std::string(
"Y Axis");
options.
xAxis = std::string(
"X Axis");
options.
intervalext = std::string(
"{'i2': { 'color': '#4374E0', 'style':'bars', 'lineWidth':4, 'fillOpacity':1 } }");
cg.
write(
"gc_plot_out.html");
Definition at line 215 of file GoogleChart.hpp.
|
template<typename Y > |
void | AddHistGraph (openfpm::vector< Y > &y) |
| Add an histogram graph.
|
|
template<typename X , typename Y > |
void | AddHistGraph (openfpm::vector< X > &x, openfpm::vector< Y > &y) |
| Add an histogram graph.
|
|
template<typename X , typename Y , typename Yn > |
void | AddHistGraph (openfpm::vector< X > &x, openfpm::vector< Y > &y, openfpm::vector< Yn > &yn) |
| Add an histogram graph.
|
|
template<typename X , typename Y , typename Yn > |
void | AddHistGraph (openfpm::vector< X > &x, openfpm::vector< Y > &y, openfpm::vector< Yn > &yn, const GCoptions &opt) |
| Add an histogram graph.
|
|
template<typename ... X> |
void | AddLines (const openfpm::vector< std::string > &yn, const GCoptions &opt, X ... xy) |
| Add lines graph.
|
|
template<typename X , typename Y > |
void | AddLinesGraphT (openfpm::vector< X > &x, openfpm::vector< Y > &y, const GCoptions &opt) |
| Add lines graph.
|
|
template<typename X , typename Y > |
void | AddLinesGraph (openfpm::vector< X > &x, openfpm::vector< Y > &y, const GCoptions &opt) |
| Add a simple lines graph.
|
|
template<typename X , typename Y > |
void | AddLinesGraph (openfpm::vector< X > &x, openfpm::vector< Y > &y, const openfpm::vector< std::string > &yn, const GCoptions &opt) |
| Add a simple plot graph.
|
|
void | addHTML (const std::string &html) |
| Add HTML text.
|
|
void | write (std::string file) |
| It write the graphs on file in html format using Google charts.
|
|
|
template<typename X , typename ... Xs> |
void | recursive_sort (X &x, X &y, Xs &... xy) |
| Recursively sort variadic template of vectors.
|
|
void | recursive_sort () |
| terminator for recursive sort
|
|
template<typename X , typename ... Xs> |
bool | isNext (size_t *counters, X &x, X &y, Xs &... xy) |
| Recursively sort variadic template of vectors.
|
|
bool | isNext (size_t *counters) |
| Recursively sort variadic template of vectors.
|
|
template<typename T , typename X , typename ... Xs> |
T | get_low (size_t *counters, X &x, X &y, Xs &... xy) |
| Recursively sort variadic template of vectors.
|
|
template<typename T > |
T | get_low (size_t *counters) |
| Recursively sort variadic template of vectors.
|
|
template<typename X , typename ... Xs> |
void | get_point (typename X::value_type low, typename X::value_type *point, size_t *counters, X &x, X &y, Xs &... xy) |
| Recursively sort variadic template of vectors.
|
|
template<typename T > |
void | get_point (T low, T *point, size_t *counters) |
| Recursively sort variadic template of vectors.
|
|
template<typename ... Xs> |
bool | get_v (typename get_value_type< Xs... >::type &x, typename get_value_type< Xs... >::type *point, size_t *counters, Xs &... xy) |
| Recursively sort variadic template of vectors.
|
|
template<typename X , typename Y > |
std::string | get_points_plot_data (const openfpm::vector< X > &x, const openfpm::vector< Y > &y, const openfpm::vector< std::string > &yn, const GCoptions &opt, size_t i) |
| Given X and Y vector return the string representing the data section of the Google Chart.
|
|
std::string | get_view_bar_option (const GCoptions &opt, size_t n_col) |
| Construct a view option.
|
|
std::string | get_colums_bar_option (const GCoptions &opt) |
|
std::string | get_points_plot_option (const GCoptions &opt) |
|
void | addData (std::ofstream &of, size_t i, const std::string &data) |
| Add a graph data variable.
|
|
void | addOption (std::ofstream &of, size_t i, const std::string &opt) |
| Add an option data variable.
|
|
void | addView (std::ofstream &of, size_t i, std::string view) |
| Add a view data variable.
|
|
void | addDrawDiv (std::ofstream &of, size_t i, bool draw_view) |
| Add a draw div section.
|
|
void | addDiv (std::ofstream &of, size_t i, const GCoptions &gc) |
| Add a div section.
|
|