Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
XChart
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brady James Garvin
XChart
Commits
74caf0e3
Commit
74caf0e3
authored
11 years ago
by
ruX[Ruslan Zaharov]
Browse files
Options
Downloads
Patches
Plain Diff
Chart constructor with custom theme
parent
6b99e929
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
xchart/src/main/java/com/xeiam/xchart/Chart.java
+17
-17
17 additions, 17 deletions
xchart/src/main/java/com/xeiam/xchart/Chart.java
xchart/src/main/java/com/xeiam/xchart/StyleManager.java
+22
-7
22 additions, 7 deletions
xchart/src/main/java/com/xeiam/xchart/StyleManager.java
with
39 additions
and
24 deletions
xchart/src/main/java/com/xeiam/xchart/Chart.java
+
17
−
17
View file @
74caf0e3
...
...
@@ -15,18 +15,16 @@
*/
package
com.xeiam.xchart
;
import
java.awt.Graphics2D
;
import
com.xeiam.xchart.StyleManager.ChartTheme
;
import
com.xeiam.xchart.internal.chartpart.ChartPainter
;
import
com.xeiam.xchart.internal.style.Theme
;
import
java.awt.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Map
;
import
com.xeiam.xchart.StyleManager.ChartTheme
;
import
com.xeiam.xchart.internal.chartpart.ChartPainter
;
import
com.xeiam.xchart.internal.style.GGPlot2Theme
;
import
com.xeiam.xchart.internal.style.MatlabTheme
;
import
com.xeiam.xchart.internal.style.XChartTheme
;
/**
* An XChart Chart
*
...
...
@@ -56,18 +54,20 @@ public class Chart {
* @param chartTheme
*/
public
Chart
(
int
width
,
int
height
,
ChartTheme
chartTheme
)
{
this
(
width
,
height
,
chartTheme
.
newInstance
(
chartTheme
));
}
chartPainter
=
new
ChartPainter
(
width
,
height
);
/**
* Constructor
*
* @param width
* @param height
* @param theme instance of Theme class
*/
public
Chart
(
int
width
,
int
height
,
Theme
theme
)
{
if
(
chartTheme
==
ChartTheme
.
XChart
)
{
chartPainter
.
getStyleManager
().
setTheme
(
new
XChartTheme
());
}
else
if
(
chartTheme
==
ChartTheme
.
GGPlot2
)
{
chartPainter
.
getStyleManager
().
setTheme
(
new
GGPlot2Theme
());
}
else
if
(
chartTheme
==
ChartTheme
.
Matlab
)
{
chartPainter
.
getStyleManager
().
setTheme
(
new
MatlabTheme
());
}
chartPainter
=
new
ChartPainter
(
width
,
height
);
chartPainter
.
getStyleManager
().
setTheme
(
theme
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
xchart/src/main/java/com/xeiam/xchart/StyleManager.java
+
22
−
7
View file @
74caf0e3
...
...
@@ -15,15 +15,15 @@
*/
package
com.xeiam.xchart
;
import
java.awt.Color
;
import
java.awt.Font
;
import
java.awt.Stroke
;
import
java.util.Locale
;
import
java.util.TimeZone
;
import
com.xeiam.xchart.internal.style.GGPlot2Theme
;
import
com.xeiam.xchart.internal.style.MatlabTheme
;
import
com.xeiam.xchart.internal.style.Theme
;
import
com.xeiam.xchart.internal.style.XChartTheme
;
import
java.awt.*
;
import
java.util.Locale
;
import
java.util.TimeZone
;
/**
* The StyleManager is used to manage all things related to styling of the vast number of Chart components
*
...
...
@@ -46,7 +46,22 @@ public class StyleManager {
public
enum
ChartTheme
{
XChart
,
GGPlot2
,
Matlab
XChart
,
GGPlot2
,
Matlab
;
public
Theme
newInstance
(
ChartTheme
chartTheme
)
{
switch
(
chartTheme
)
{
case
GGPlot2:
return
new
GGPlot2Theme
();
case
Matlab:
return
new
MatlabTheme
();
case
XChart:
default
:
return
new
XChartTheme
();
}
}
}
/** the default Theme */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment