BrightSide Workbench Full Report + Source Code
org.turro.charts.Chart Class Reference
Inheritance diagram for org.turro.charts.Chart:
Collaboration diagram for org.turro.charts.Chart:

Public Member Functions

 Chart (IConstructor constructor)
 
ArrayList< SeriesgetSeries ()
 
Series addSeries (String name)
 
String getPieData ()
 
String getLineData ()
 
String parsePie (String identifier)
 
String parseLine (String identifier)
 
String parsePie (String identifier, String title)
 
String parseLine (String identifier, String title)
 

Protected Member Functions

void loadData ()
 

Protected Attributes

IConstructor constructor
 
ArrayList< Seriesseries
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 30 of file Chart.java.

Constructor & Destructor Documentation

◆ Chart()

org.turro.charts.Chart.Chart ( IConstructor  constructor)

Definition at line 35 of file Chart.java.

35  {
36  this.constructor = constructor;
37  this.series = new ArrayList<>();
38  }
IConstructor constructor
Definition: Chart.java:32
ArrayList< Series > series
Definition: Chart.java:33

Member Function Documentation

◆ addSeries()

Series org.turro.charts.Chart.addSeries ( String  name)

Definition at line 44 of file Chart.java.

44  {
45  Series s = new Series(name);
46  if(series.add(s)) {
47  return s;
48  }
49  return null;
50  }
Here is the caller graph for this function:

◆ getLineData()

String org.turro.charts.Chart.getLineData ( )

Definition at line 78 of file Chart.java.

78  {
79  StringBuilder sb = new StringBuilder();
80  for(Series s : series) {
81  if(sb.length() > 0) {
82  sb.append(",");
83  }
84  sb.append("[");
85  boolean first = true;
86  for(Data d : s.getData()) {
87  if(first) { first = false; } else { sb.append(","); }
88  sb.append("{name:\"")
89  .append(d.key)
90  .append("\",y:")
91  .append(d.getValue(0.0));
92  if(!Strings.isBlank(d.getLink())) {
93  sb.append(",events:{click:function(){location.href=\"")
94  .append(d.getLink())
95  .append("\"}}");
96  }
97  sb.append("}");
98  }
99  sb.append("]");
100  }
101  return sb.toString();
102  }
Here is the caller graph for this function:

◆ getPieData()

String org.turro.charts.Chart.getPieData ( )

Definition at line 52 of file Chart.java.

52  {
53  StringBuilder sb = new StringBuilder();
54  for(Series s : series) {
55  if(sb.length() > 0) {
56  sb.append(",");
57  }
58  sb.append("[");
59  boolean first = true;
60  for(Data d : s.getData()) {
61  if(first) { first = false; } else { sb.append(","); }
62  sb.append("{name:\"")
63  .append(d.key)
64  .append("\",y:")
65  .append(d.getValue(0.0));
66  if(!Strings.isBlank(d.getLink())) {
67  sb.append(",events:{click:function(){location.href=\"")
68  .append(d.getLink())
69  .append("\"}}");
70  }
71  sb.append("}");
72  }
73  sb.append("]");
74  }
75  return sb.toString();
76  }
Here is the caller graph for this function:

◆ getSeries()

ArrayList<Series> org.turro.charts.Chart.getSeries ( )

Definition at line 40 of file Chart.java.

40  {
41  return series;
42  }

◆ loadData()

void org.turro.charts.Chart.loadData ( )
protected

Definition at line 130 of file Chart.java.

130 {}
Here is the caller graph for this function:

◆ parseLine() [1/2]

String org.turro.charts.Chart.parseLine ( String  identifier)

Definition at line 108 of file Chart.java.

108  {
109  return parseLine(identifier, "");
110  }
String parseLine(String identifier)
Definition: Chart.java:108

◆ parseLine() [2/2]

String org.turro.charts.Chart.parseLine ( String  identifier,
String  title 
)

Definition at line 121 of file Chart.java.

121  {
122  if(series.isEmpty()) loadData();
123  ElephantMarker marker = new ElephantMarker(constructor);
124  marker.put("identifier", identifier);
125  marker.put("title", title);
126  marker.put("data", getLineData());
127  return marker.parse("charts", "line");
128  }
String getLineData()
Definition: Chart.java:78
Here is the call graph for this function:

◆ parsePie() [1/2]

String org.turro.charts.Chart.parsePie ( String  identifier)

Definition at line 104 of file Chart.java.

104  {
105  return parsePie(identifier, "");
106  }
String parsePie(String identifier)
Definition: Chart.java:104

◆ parsePie() [2/2]

String org.turro.charts.Chart.parsePie ( String  identifier,
String  title 
)

Definition at line 112 of file Chart.java.

112  {
113  if(series.isEmpty()) loadData();
114  ElephantMarker marker = new ElephantMarker(constructor);
115  marker.put("identifier", identifier);
116  marker.put("title", title);
117  marker.put("data", getPieData());
118  return marker.parse("charts", "pie");
119  }
String getPieData()
Definition: Chart.java:52
Here is the call graph for this function:

Member Data Documentation

◆ constructor

IConstructor org.turro.charts.Chart.constructor
protected

Definition at line 32 of file Chart.java.

◆ series

ArrayList<Series> org.turro.charts.Chart.series
protected

Definition at line 33 of file Chart.java.


The documentation for this class was generated from the following file: