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
5c8353b2
Commit
5c8353b2
authored
12 years ago
by
timmolter
Browse files
Options
Downloads
Patches
Plain Diff
new Constructor - The number of rows and columns will be calculated automatically
parent
1e738625
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
src/main/java/com/xeiam/xchart/swing/SwingWrapper.java
+19
-0
19 additions, 0 deletions
src/main/java/com/xeiam/xchart/swing/SwingWrapper.java
src/test/java/com/xeiam/xchart/example/Example4.java
+4
-7
4 additions, 7 deletions
src/test/java/com/xeiam/xchart/example/Example4.java
with
23 additions
and
7 deletions
src/main/java/com/xeiam/xchart/swing/SwingWrapper.java
+
19
−
0
View file @
5c8353b2
...
...
@@ -51,6 +51,8 @@ public class SwingWrapper {
* Deprecated Constructor - use the one that takes a Collection! This will be removed in next version.
*
* @param charts
* @param numRows
* @param numColumns
*/
@Deprecated
public
SwingWrapper
(
Chart
[]
charts
,
int
numRows
,
int
numColumns
)
{
...
...
@@ -62,10 +64,27 @@ public class SwingWrapper {
this
.
numColumns
=
numColumns
;
}
/**
* Constructor - The number of rows and columns will be calculated automatically
*
* @param charts
* @param numRows
* @param numColumns
*/
public
SwingWrapper
(
List
<
Chart
>
charts
)
{
this
.
charts
=
charts
;
this
.
numRows
=
(
int
)
(
Math
.
sqrt
(
charts
.
size
())
+
.
5
);
this
.
numColumns
=
(
int
)
((
double
)
charts
.
size
()
/
this
.
numRows
+
1
);
}
/**
* Constructor
*
* @param charts
* @param numRows - the number of rows
* @param numColumns - the number of columns
*/
public
SwingWrapper
(
List
<
Chart
>
charts
,
int
numRows
,
int
numColumns
)
{
...
...
This diff is collapsed.
Click to expand it.
src/test/java/com/xeiam/xchart/example/Example4.java
+
4
−
7
View file @
5c8353b2
...
...
@@ -31,17 +31,14 @@ public class Example4 {
public
static
void
main
(
String
[]
args
)
{
int
numRows
=
2
;
int
numCols
=
2
;
int
numCharts
=
4
;
List
<
Chart
>
charts
=
new
ArrayList
<
Chart
>();
for
(
int
i
=
0
;
i
<
numRows
;
i
++)
{
for
(
int
j
=
0
;
j
<
numCols
;
j
++)
{
charts
.
add
(
QuickChart
.
getChart
(
i
+
","
+
j
,
"X"
,
"Y"
,
null
,
null
,
getRandomWalk
(
1000
)));
}
for
(
int
i
=
0
;
i
<
numCharts
;
i
++)
{
charts
.
add
(
QuickChart
.
getChart
(
""
+
i
,
"X"
,
"Y"
,
null
,
null
,
getRandomWalk
(
1000
)));
}
new
SwingWrapper
(
charts
,
numRows
,
numCols
).
displayChartMatrix
();
new
SwingWrapper
(
charts
).
displayChartMatrix
();
}
/**
...
...
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