Anda di halaman 1dari 2

/*

* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER


*
* Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
* Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* This file is available and licensed under the following license:
*
* Redistribution and use in source and binary forms, with or without modificati
on,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
trademark notice, this list of conditions, and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice
,
trademark notice, this list of conditions, and the following disclaimer
in
the documentation and/or other materials provided with the distribution.
* * Neither the name of Oracle nor the names of its contributors may be used
to endorse or promote products derived from this software without specif
ic
prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMP
LIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLA
IMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIREC
T,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGEN
CE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADV
ISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.stage.Alert;
import javafx.scene.chart.*;
import javafx.scene.chart.part.*;

def barSeries1: BarChart.Series = BarChart.Series {


name: "1996"
data: [
BarChart.Data { category: "Austria" value: 25601.34 action:function(
){Alert.inform("Clicked on Austria=25601.34")} },
BarChart.Data { category: "Brazil" value: 20148.82 action:function(
){Alert.inform("Clicked on Brazil=20148.82")} },
BarChart.Data { category: "France" value: -10000 action:function(){
Alert.inform("Clicked on France=-10000")} },
BarChart.Data { category: "Italy" value: 35407.15 action:function(
){Alert.inform("Clicked on Italy=35407.15")} },
BarChart.Data { category: "USA" value: -12000 action:function(){
Alert.inform("Clicked on USA=-12000")} }
]
}
def barSeries2: BarChart.Series = BarChart.Series {
name: "1997"
data: [
BarChart.Data { category: "Austria" value: 57401.85 },
BarChart.Data { category: "Brazil" value: 41941.19 },
BarChart.Data { category: "France" value: 45263.37 },
BarChart.Data { category: "Italy" value: 117320.16 },
BarChart.Data { category: "USA" value: 114845.27 }
]
}
def barSeries3: BarChart.Series = BarChart.Series {
name: "1998"
data: [
BarChart.Data { category: "Austria" value: 45000.65 },
BarChart.Data { category: "Brazil" value: 44835.76 },
BarChart.Data { category: "France" value: 18722.18 },
BarChart.Data { category: "Italy" value: -17557.31 },
BarChart.Data { category: "USA" value: 92633.68 }
]
}
def barChart = BarChart {
title: "Country Comparison"
data: [barSeries1, barSeries2, barSeries3]
categoryAxis: CategoryAxis {
categories: ["Austria","Brazil","France","Italy","USA"]
}
valueAxis: NumberAxis {
lowerBound: -20000
upperBound: 120000
tickUnit: 20000
}
}
Stage {
title: "Bar Chart"
scene: Scene{
width: 550
height: 410
content: barChart
} //Scene
}//Stage

Anda mungkin juga menyukai