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
ebe1a027
Commit
ebe1a027
authored
10 years ago
by
Hwaipy Li
Browse files
Options
Downloads
Plain Diff
Merge branch 'adv-histogram'
parents
1cfc7c79
55e6da38
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xchart/src/main/java/com/xeiam/xchart/Histogram.java
+14
-11
14 additions, 11 deletions
xchart/src/main/java/com/xeiam/xchart/Histogram.java
with
14 additions
and
11 deletions
xchart/src/main/java/com/xeiam/xchart/Histogram.java
+
14
−
11
View file @
ebe1a027
...
...
@@ -17,7 +17,6 @@ package com.xeiam.xchart;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
...
...
@@ -46,14 +45,19 @@ public class Histogram {
this
.
numBins
=
numBins
;
this
.
originalData
=
data
;
List
<
Double
>
dataAsList
=
new
ArrayList
<
Double
>();
Iterator
<?
extends
Number
>
itr
=
data
.
iterator
();
while
(
itr
.
hasNext
())
{
dataAsList
.
add
(((
Number
)
itr
.
next
()).
doubleValue
());
Double
tempMax
=
Double
.
MIN_VALUE
;
Double
tempMin
=
Double
.
MAX_VALUE
;
for
(
Number
number
:
data
)
{
double
value
=
number
.
doubleValue
();
if
(
value
>
tempMax
)
{
tempMax
=
value
;
}
if
(
value
<
tempMin
)
{
tempMin
=
value
;
}
}
Collections
.
sort
(
dataAsList
);
this
.
min
=
dataAsList
.
get
(
0
);
this
.
max
=
dataAsList
.
get
(
dataAsList
.
size
()
-
1
);
max
=
tempMax
;
min
=
tempMin
;
init
();
}
...
...
@@ -92,8 +96,7 @@ public class Histogram {
else
if
(
bin
>
numBins
)
{
/* this data point is bigger than max */
// System.out.println("greater than");
}
else
if
(
bin
==
numBins
)
{
// this falls right on the edge of the max bin
tempYAxisData
[
bin
-
1
]
+=
1
;
else
if
(
bin
==
numBins
)
{
// this falls on the next bin of the max bin
}
else
{
tempYAxisData
[
bin
]
+=
1
;
...
...
@@ -101,7 +104,7 @@ public class Histogram {
}
yAxisData
=
new
ArrayList
<
Double
>(
numBins
);
for
(
double
d
:
tempYAxisData
)
{
yAxisData
.
add
(
new
Double
(
d
)
);
yAxisData
.
add
(
d
);
}
// x axis data
...
...
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