StarBoard Orange - Example application No.1 GoogleChartLogger with StarBoard Orange

Dependencies:   EthernetNetIf mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GoogleChart.h Source File

GoogleChart.h

00001 /**
00002  * GoogleChart API interface driver. (Version 0.0.1)
00003  *
00004  * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
00005  * http://shinta.main.jp/
00006  */
00007 
00008 #ifndef _GOOGLE_CHART_H_
00009 #define _GOOGLE_CHART_H_
00010 
00011 #include <string.h>
00012 #include <string>
00013 #include <ctype.h>
00014 
00015 #include <mbed.h>
00016 
00017 #include "Axis.h"
00018 #include "DataSet.h"
00019 
00020 class GoogleChart {
00021 public:
00022 
00023     GoogleChart();
00024     virtual ~GoogleChart();
00025 
00026     virtual std::string toString() = 0;
00027 
00028     int addNewAxis(Axis::Type type = Axis::Bottom);
00029     int setAxisType(const int number, Axis::Type type);
00030     int setAxisRange(const int number, int rangeStart, int rangeEnd);
00031     int removeAxis(const int number);
00032     
00033     int addNewDataSet(std::string label, const int size);
00034     int removeDataSet(const int number);
00035     int addData(const int number, double data);
00036     int clearAllData(const int number);
00037     int setDataScale(const int number, int min, int max);
00038 
00039     void setTitle(std::string title);
00040     std::string getTitle() const;
00041     void setWidth(int width);
00042     int getWidth() const;
00043     void setHeight(int height);
00044     int getHeight() const;
00045 
00046 protected:
00047     static const std::string baseURL;
00048     std::string title;
00049     int width;
00050     int height;
00051     
00052     static const int MAX_AXIS = 16;
00053     Axis *axislist[MAX_AXIS];
00054     
00055     static const int MAX_DATA = 16;
00056     DataSet *datalist[MAX_DATA];
00057 
00058     typedef enum {
00059         LineChart
00060     } ChartType;
00061 
00062     static std::string toURL(std::string text);
00063 
00064     static std::string paramChartType(ChartType chartType);
00065     static std::string paramAxis(Axis **list, int size);
00066     static std::string paramDataSet(DataSet **list, int size);
00067     static std::string paramTitle(std::string title, int color, double fontSize);
00068     static std::string paramSize(int width, int height);
00069 };
00070 
00071 #endif