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
91701cce
Commit
91701cce
authored
13 years ago
by
Alex Nugent
Browse files
Options
Downloads
Patches
Plain Diff
sadf
parent
4b70ad19
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
dist/xchart-1.0.0.jar
+0
-0
0 additions, 0 deletions
dist/xchart-1.0.0.jar
src/com/xeiam/xcharts/example/HugeChart.java
+95
-0
95 additions, 0 deletions
src/com/xeiam/xcharts/example/HugeChart.java
with
95 additions
and
0 deletions
dist/xchart-1.0.0.jar
+
0
−
0
View file @
91701cce
No preview for this file type
This diff is collapsed.
Click to expand it.
src/com/xeiam/xcharts/example/HugeChart.java
0 → 100644
+
95
−
0
View file @
91701cce
/**
* Copyright 2011 Xeiam LLC.
*
* 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.
*/
package
com.xeiam.xcharts.example
;
import
java.awt.BorderLayout
;
import
javax.swing.JFrame
;
import
javax.swing.JPanel
;
import
com.xeiam.xcharts.Chart
;
import
com.xeiam.xcharts.JChartPanel
;
import
com.xeiam.xcharts.series.Series
;
/**
* @author timmolter
*/
public
class
HugeChart
{
private
static
void
createAndShowGUI
()
{
// Create and set up the window.
JFrame
frame
=
new
JFrame
(
"XChart"
);
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setUndecorated
(
true
);
// Create Chart
Chart
chart
=
new
Chart
(
800
,
600
);
long
t
=
System
.
currentTimeMillis
();
// generates linear data
int
b
=
1000000
;
double
[]
xData
=
new
double
[
b
+
1
];
double
[]
yData
=
new
double
[
b
+
1
];
for
(
int
x
=
0
;
x
<=
b
;
x
++)
{
xData
[
x
]
=
x
;
yData
[
x
]
=
x
;
}
long
t1
=
System
.
currentTimeMillis
()
-
t
;
t
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"B:"
+
System
.
currentTimeMillis
());
// Customize Chart
chart
.
setChartTitle
(
"Sample Chart"
);
chart
.
setXAxisTitle
(
"X"
);
chart
.
setYAxisTitle
(
"Y"
);
// chart.setChartTitleVisible(false);
// chart.setChartLegendVisible(false);
// chart.setAxisTitlesVisible(false);
Series
series
=
chart
.
addSeries
(
"big data set"
,
xData
,
yData
);
// series.setLineColor(SeriesColor.PURPLE);
// series.setLineStyle(SeriesLineStyle.NONE);
// series.setMarkerColor(SeriesColor.GREEN);
// series.setMarker(SeriesMarker.NONE);
// Swing
JPanel
chartPanel
=
new
JChartPanel
(
chart
);
// add the panel to the content pane
frame
.
getContentPane
().
add
(
chartPanel
,
BorderLayout
.
CENTER
);
// Display the window
frame
.
pack
();
frame
.
setLocationRelativeTo
(
null
);
// centers on screen
frame
.
setVisible
(
true
);
long
t2
=
System
.
currentTimeMillis
()
-
t
;
System
.
out
.
println
(
"Data Generation Time: "
+
t1
);
System
.
out
.
println
(
"Plot Generation Time: "
+
t2
);
}
public
static
void
main
(
String
[]
args
)
{
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax
.
swing
.
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
createAndShowGUI
();
}
});
}
}
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