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
bcc888c3
Commit
bcc888c3
authored
12 years ago
by
timmolter
Browse files
Options
Downloads
Patches
Plain Diff
formatted
parent
911011c8
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
sample/com/xeiam/examples/Example2.java
+29
-29
29 additions, 29 deletions
sample/com/xeiam/examples/Example2.java
sample/com/xeiam/examples/Example3.java
+22
-22
22 additions, 22 deletions
sample/com/xeiam/examples/Example3.java
with
51 additions
and
51 deletions
sample/com/xeiam/examples/Example2.java
+
29
−
29
View file @
bcc888c3
...
...
@@ -29,35 +29,35 @@ import com.xeiam.xcharts.series.SeriesMarker;
*/
public
class
Example2
{
public
static
void
main
(
String
[]
args
)
{
// generates sine data
int
size
=
30
;
double
[]
xData1
=
new
double
[
size
+
1
];
double
[]
yData1
=
new
double
[
size
+
1
];
for
(
int
i
=
0
;
i
<=
size
;
i
++)
{
double
radians
=
(
Math
.
PI
/
(
size
/
2
)
*
i
);
xData1
[
i
]
=
i
-
size
/
2
;
yData1
[
i
]
=
size
*
Math
.
sin
(
radians
);
}
// Create Chart
Chart
chart
=
new
Chart
(
440
,
300
);
// Customize Chart
chart
.
setChartTitleVisible
(
false
);
chart
.
setChartLegendVisible
(
false
);
chart
.
setAxisTitlesVisible
(
false
);
// Series 1
Series
series1
=
chart
.
addSeries
(
"y=sin(x)"
,
xData1
,
yData1
);
series1
.
setLineColor
(
SeriesColor
.
PURPLE
);
series1
.
setLineStyle
(
SeriesLineStyle
.
DASH_DASH
);
series1
.
setMarkerColor
(
SeriesColor
.
GREEN
);
series1
.
setMarker
(
SeriesMarker
.
SQUARE
);
SwingWrapper
swingHelper
=
new
SwingWrapper
(
chart
);
swingHelper
.
displayChart
();
public
static
void
main
(
String
[]
args
)
{
// generates sine data
int
size
=
30
;
double
[]
xData1
=
new
double
[
size
+
1
];
double
[]
yData1
=
new
double
[
size
+
1
];
for
(
int
i
=
0
;
i
<=
size
;
i
++)
{
double
radians
=
(
Math
.
PI
/
(
size
/
2
)
*
i
);
xData1
[
i
]
=
i
-
size
/
2
;
yData1
[
i
]
=
size
*
Math
.
sin
(
radians
);
}
// Create Chart
Chart
chart
=
new
Chart
(
440
,
300
);
// Customize Chart
chart
.
setChartTitleVisible
(
false
);
chart
.
setChartLegendVisible
(
false
);
chart
.
setAxisTitlesVisible
(
false
);
// Series 1
Series
series1
=
chart
.
addSeries
(
"y=sin(x)"
,
xData1
,
yData1
);
series1
.
setLineColor
(
SeriesColor
.
PURPLE
);
series1
.
setLineStyle
(
SeriesLineStyle
.
DASH_DASH
);
series1
.
setMarkerColor
(
SeriesColor
.
GREEN
);
series1
.
setMarker
(
SeriesMarker
.
SQUARE
);
SwingWrapper
swingHelper
=
new
SwingWrapper
(
chart
);
swingHelper
.
displayChart
();
}
}
This diff is collapsed.
Click to expand it.
sample/com/xeiam/examples/Example3.java
+
22
−
22
View file @
bcc888c3
...
...
@@ -25,34 +25,34 @@ import com.xeiam.xcharts.Chart;
*/
public
class
Example3
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// Create Chart
Chart
chart
=
new
Chart
(
700
,
500
);
// Create Chart
Chart
chart
=
new
Chart
(
700
,
500
);
for
(
int
i
=
1
;
i
<=
14
;
i
++)
{
for
(
int
i
=
1
;
i
<=
14
;
i
++)
{
// generates linear data
int
b
=
20
;
double
[]
xData
=
new
double
[
b
+
1
];
double
[]
yData
=
new
double
[
b
+
1
];
for
(
int
x
=
0
;
x
<=
b
;
x
++)
{
xData
[
x
]
=
2
*
x
-
b
;
yData
[
x
]
=
2
*
i
*
x
-
i
*
b
;
}
// generates linear data
int
b
=
20
;
double
[]
xData
=
new
double
[
b
+
1
];
double
[]
yData
=
new
double
[
b
+
1
];
for
(
int
x
=
0
;
x
<=
b
;
x
++)
{
xData
[
x
]
=
2
*
x
-
b
;
yData
[
x
]
=
2
*
i
*
x
-
i
*
b
;
}
// Customize Chart
chart
.
setChartTitle
(
"Sample Chart"
);
chart
.
setXAxisTitle
(
"X"
);
chart
.
setYAxisTitle
(
"Y"
);
// Customize Chart
chart
.
setChartTitle
(
"Sample Chart"
);
chart
.
setXAxisTitle
(
"X"
);
chart
.
setYAxisTitle
(
"Y"
);
String
seriesName
=
"y="
+
2
*
i
+
"x-"
+
i
*
b
+
"b"
;
chart
.
addSeries
(
seriesName
,
xData
,
yData
);
String
seriesName
=
"y="
+
2
*
i
+
"x-"
+
i
*
b
+
"b"
;
chart
.
addSeries
(
seriesName
,
xData
,
yData
);
}
SwingWrapper
swingHelper
=
new
SwingWrapper
(
chart
);
swingHelper
.
displayChart
();
}
SwingWrapper
swingHelper
=
new
SwingWrapper
(
chart
);
swingHelper
.
displayChart
();
}
}
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