Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GoogleChartJSF
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alex Rhodes
GoogleChartJSF
Commits
3b97a83d
Commit
3b97a83d
authored
Aug 03, 2016
by
Alex Rhodes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support for stacked bars and legend position
parent
f190449b
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
88 additions
and
10 deletions
+88
-10
index.xhtml
WebContent/index.xhtml
+2
-2
pom.xml
pom.xml
+1
-1
Builder.java
src/com/alexscottrhodes/builder/Builder.java
+2
-0
GoogleComboChart.java
src/com/alexscottrhodes/chartModel/GoogleComboChart.java
+24
-0
Charts.java
src/com/alexscottrhodes/demo/Charts.java
+4
-1
LegendPosition.java
src/com/alexscottrhodes/enums/LegendPosition.java
+49
-0
Builder.class
target/classes/com/alexscottrhodes/builder/Builder.class
+0
-0
MANIFEST.MF
target/m2e-wtp/web-resources/META-INF/MANIFEST.MF
+2
-2
pom.properties
target/m2e-wtp/web-resources/META-INF/maven/com.alexscottrhodes/GoogleChartsJSF/pom.properties
+3
-3
pom.xml
target/m2e-wtp/web-resources/META-INF/maven/com.alexscottrhodes/GoogleChartsJSF/pom.xml
+1
-1
No files found.
WebContent/index.xhtml
View file @
3b97a83d
...
...
@@ -34,8 +34,8 @@ is loaded from Google's servers as required in the Google Terms of Service.
</h:head>
<h:body>
<!-- Charts are passed the type corresponding to the type of chart being rendered, and the chart object -->
<gc:googleChart
type=
"combo"
value=
"#{googleChartBean.combo}"
width=
"
400"
height=
"4
00"
/>
<gc:googleChart
type=
"pie"
value=
"#{googleChartBean.pie}"
width=
"
300"
height=
"2
00"
/>
<gc:googleChart
type=
"combo"
value=
"#{googleChartBean.combo}"
width=
"
1200"
height=
"6
00"
/>
<gc:googleChart
type=
"pie"
value=
"#{googleChartBean.pie}"
width=
"
600"
height=
"6
00"
/>
</h:body>
</html>
pom.xml
View file @
3b97a83d
...
...
@@ -27,7 +27,7 @@ is loaded from Google's servers as required in the Google Terms of Service.
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.alexscottrhodes
</groupId>
<artifactId>
GoogleChartsJSF
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<version>
1.3
</version>
<packaging>
war
</packaging>
<name>
Google Charts JSF API
</name>
<description>
JSF tag wrapper for google charts objects
</description>
...
...
src/com/alexscottrhodes/builder/Builder.java
View file @
3b97a83d
...
...
@@ -133,8 +133,10 @@ public class Builder {
yLabel
=
""
;
}
options
+=
"hAxis: {title:'"
+
x
.
getLabel
()+
"'},"
;
options
+=
"legend : {position: '"
+
gcc
.
getLegendPosition
().
toString
()
+
"'},"
;
options
+=
"vAxis: {title:'"
+
yLabel
+
"'},"
;
options
+=
"curveType: '"
+
gcc
.
getCurveType
().
toString
()
+
"',"
;
options
+=
"isStacked: "
+
gcc
.
isStacked
()
+
","
;
options
+=
"seriesType: '"
+
x
.
getDisplayType
().
toString
()
+
"',"
;
String
innerSeries
=
"series:{"
;
for
(
int
i
=
0
;
i
<
gcc
.
getSeriesList
().
size
();
i
++){
...
...
src/com/alexscottrhodes/chartModel/GoogleComboChart.java
View file @
3b97a83d
...
...
@@ -31,6 +31,7 @@ import java.util.HashMap;
import
com.alexscottrhodes.constructionModel.ChartSeries
;
import
com.alexscottrhodes.enums.AxisType
;
import
com.alexscottrhodes.enums.CurveType
;
import
com.alexscottrhodes.enums.LegendPosition
;
/**
* Model of the Google Combo chart object
* @author Alex Rhodes
...
...
@@ -90,6 +91,17 @@ public class GoogleComboChart {
*/
private
CurveType
curveType
=
CurveType
.
DEFAULT
;
/**
* The LegendPosition to place the legend when rendering the chart.
* See <a href="https://developers.google.com/chart/glossary">Google Charts API</a>
*/
private
LegendPosition
legendPosition
=
LegendPosition
.
RIGHT
;
/**
* A boolean for Bar type charts to indicate if the bars should be stacekd or adjacent.
*/
private
boolean
stacked
;
public
GoogleComboChart
(){
seriesList
=
new
ArrayList
<
ChartSeries
>();
axes
=
new
HashMap
<
AxisType
,
ArrayList
<
ChartSeries
>>();
...
...
@@ -200,5 +212,17 @@ public class GoogleComboChart {
public
void
setCurveType
(
CurveType
curveType
)
{
this
.
curveType
=
curveType
;
}
public
LegendPosition
getLegendPosition
()
{
return
legendPosition
;
}
public
void
setLegendPosition
(
LegendPosition
legendPosition
)
{
this
.
legendPosition
=
legendPosition
;
}
public
boolean
isStacked
()
{
return
stacked
;
}
public
void
setStacked
(
boolean
stacked
)
{
this
.
stacked
=
stacked
;
}
}
src/com/alexscottrhodes/demo/Charts.java
View file @
3b97a83d
...
...
@@ -35,6 +35,7 @@ import com.alexscottrhodes.chartModel.components.PieSlice;
import
com.alexscottrhodes.constructionModel.ChartSeries
;
import
com.alexscottrhodes.enums.AxisType
;
import
com.alexscottrhodes.enums.CurveType
;
import
com.alexscottrhodes.enums.LegendPosition
;
import
com.alexscottrhodes.enums.SeriesDisplayType
;
import
com.alexscottrhodes.enums.SeriesType
;
/**
...
...
@@ -59,7 +60,7 @@ public class Charts {
ChartSeries
s
=
new
ChartSeries
(
SeriesType
.
NUMBER
);
// Add a series of
// numbers
s
.
setDisplayType
(
SeriesDisplayType
.
LINE
);
// Make this series a line
s
.
setDisplayType
(
SeriesDisplayType
.
BAR
);
// Make this series a line
s
.
setLabel
(
"A line of values over time."
);
for
(
Integer
i
:
getRandVals
())
{
s
.
addPoint
(
i
);
// Populate with some random numbers
...
...
@@ -84,6 +85,8 @@ public class Charts {
gcc
.
addSeries
(
s
);
// Add series S
gcc
.
addSeries
(
t
);
// Add series T
gcc
.
addAxisSeries
(
x
,
AxisType
.
X
);
// Add the X-axis
gcc
.
setStacked
(
true
);
gcc
.
setLegendPosition
(
LegendPosition
.
HIDDEN
);
return
gcc
;
}
...
...
src/com/alexscottrhodes/enums/LegendPosition.java
0 → 100644
View file @
3b97a83d
/*
Google Charts JSF Wrapper
Copyright (C) 2016 Alex Rhodes
https://www.alexscottrhodes.com
Information about this project including set-up and configuration information can be found here:
https://bitbucket.org/alexscottrhodes/googlechartjsf
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
© 2016 "Google" and the Google logo are registered trademarks of Google Inc.
The Google Charts API is used under the Apache 2.0 License above. Google software
is loaded from Google's servers as required in the Google Terms of Service.
*/
package
com
.
alexscottrhodes
.
enums
;
/**
* An Enum for the "curve type" parameter of the Google chart API;
* @author arhodes
*
*/
public
enum
LegendPosition
{
TOP
(
"top"
),
LEFT
(
"left"
),
RIGHT
(
"right"
),
BOTTOM
(
"bottom"
),
IN
(
"in"
),
HIDDEN
(
"none"
);
private
String
plainText
;
LegendPosition
(
String
pt
){
this
.
plainText
=
pt
;
}
@Override
public
String
toString
(){
return
plainText
;
}
}
target/classes/com/alexscottrhodes/builder/Builder.class
View file @
3b97a83d
No preview for this file type
target/m2e-wtp/web-resources/META-INF/MANIFEST.MF
View file @
3b97a83d
Manifest-Version: 1.0
Built-By:
Alex
Build-Jdk: 1.8.0_
51
Built-By:
arhodes
Build-Jdk: 1.8.0_
92
Created-By: Maven Integration for Eclipse
target/m2e-wtp/web-resources/META-INF/maven/com.alexscottrhodes/GoogleChartsJSF/pom.properties
View file @
3b97a83d
#Generated by Maven Integration for Eclipse
#
Thu Jul 28 19:10:15
MST 2016
version
=
0.0.1-SNAPSHOT
#
Wed Aug 03 13:27:26
MST 2016
version
=
1.3
groupId
=
com.alexscottrhodes
m2e.projectName
=
googlechartjsf
m2e.projectLocation
=
E
\:\\
Portfolio W
orkspace
\\
googlechartjsf
m2e.projectLocation
=
C
\:\\
w
orkspace
\\
googlechartjsf
artifactId
=
GoogleChartsJSF
target/m2e-wtp/web-resources/META-INF/maven/com.alexscottrhodes/GoogleChartsJSF/pom.xml
View file @
3b97a83d
...
...
@@ -27,7 +27,7 @@ is loaded from Google's servers as required in the Google Terms of Service.
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.alexscottrhodes
</groupId>
<artifactId>
GoogleChartsJSF
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<version>
1.3
</version>
<packaging>
war
</packaging>
<name>
Google Charts JSF API
</name>
<description>
JSF tag wrapper for google charts objects
</description>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment