24#include "Plot/GoogleChart.hpp"
25#include "VCluster/VCluster.hpp"
29int main(
int argc,
char* argv[])
47 openfpm_init(&argc,&argv);
48 auto & v_cl = create_vcluster();
51 if (v_cl.getProcessingUnits() > 1)
53 std::cerr <<
"Error: only one processor is allowed" <<
"\n";
171 options.
title = std::string(
"Example");
172 options.
yAxis = std::string(
"Y Axis");
173 options.
xAxis = std::string(
"X Axis");
202 cg.
addHTML(
"<h2>First graph</h2>");
235 options.
stype = std::string(
"bars");
238 options.
stypeext = std::string(
"{3: {type: 'line'}}");
240 cg.
addHTML(
"<h2>Second graph</h2>");
266 cg.
addHTML(
"<h2>Third graph</h2>");
272 y.add({0.10,0.20,0.19});
273 y.add({0.11,0.21,0.18});
274 y.add({0.12,0.22,0.21});
275 y.add({0.15,0.25,0.20});
276 y.add({0.09,0.29,0.25});
277 y.add({0.08,0.28,0.27});
307 cg.
addHTML(
"<h2>Four graph</h2>");
311 y.add({0.10,0.20,0.19,0.22,0.195,0.215,0.35,0.34,0.36});
312 y.add({0.11,0.21,0.18,0.22,0.19,0.215,0.36,0.35,0.37});
313 y.add({0.12,0.22,0.21,0.23,0.215,0.225,0.35,0.34,0.36});
314 y.add({0.15,0.25,0.20,0.26,0.22,0.255,0.36,0.35,0.37});
315 y.add({0.09,0.29,0.25,0.30,0.26,0.295,0.35,0.34,0.36});
316 y.add({0.08,0.28,0.27,0.29,0.275,0.285,0.36,0.35,0.37});
335 options.
intervalext = std::string(
"{'i2': { 'color': '#4374E0', 'style':'bars', 'lineWidth':4, 'fillOpacity':1 } }");
378 options.
width = 1280;
381 options.
more = GC_ZOOM +
"," + GC_X_LOG +
"," + GC_Y_LOG;
385 cg.
write(
"gc_out.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 AddLinesGraph(openfpm::vector< X > &x, openfpm::vector< Y > &y, const GCoptions &opt)
Add a simple lines graph.
void AddHistGraph(openfpm::vector< Y > &y)
Add an histogram graph.
void addHTML(const std::string &html)
Add HTML text.
Implementation of 1-D std::vector like structure.
size_t width
width of the graph in pixels
size_t heigh
height of the graph in pixels
std::string xAxis
X axis name.
size_t lineWidth
Width of the line.
std::string curveType
curve type
std::string title
Title of the chart.
std::string yAxis
Y axis name.