本文整理汇总了Java中org.moxieapps.gwt.highcharts.client.Legend类的典型用法代码示例。如果您正苦于以下问题:Java Legend类的具体用法?Java Legend怎么用?Java Legend使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Legend类属于org.moxieapps.gwt.highcharts.client包,在下文中一共展示了Legend类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.moxieapps.gwt.highcharts.client.Legend; //导入依赖的package包/类
public Chart createChart() {
lgr.log(Level.INFO, "Creating Graph!!");
final Chart chart = new Chart()
.setType(Series.Type.COLUMN)
.setChartTitleText("Monthly Average Rainfall")
.setChartSubtitleText("Source: WorldClimate.com")
.setColumnPlotOptions(
new ColumnPlotOptions().setPointPadding(0.2).setBorderWidth(0))
.setLegend(
new Legend().setLayout(Legend.Layout.VERTICAL).setAlign(Legend.Align.LEFT)
.setVerticalAlign(Legend.VerticalAlign.TOP).setX(100).setY(70)
.setFloating(true).setBackgroundColor("#FFFFFF").setShadow(true))
.setToolTip(new ToolTip().setFormatter(new ToolTipFormatter() {
@Override
public String format(ToolTipData toolTipData) {
return toolTipData.getXAsString() + ": " + toolTipData.getYAsLong() + " mm";
}
}));
chart.setCredits(new Credits().setEnabled(false));
chart.getXAxis().setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec");
chart.getYAxis().setAxisTitleText("Rainfall (mm)").setMin(0);
chart.addSeries(chart
.createSeries()
.setName("Tokyo")
.setPoints(
new Number[] { 49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4,
194.1, 95.6, 54.4 }));
return chart;
}
示例2: onSelect
import org.moxieapps.gwt.highcharts.client.Legend; //导入依赖的package包/类
public void onSelect(SelectEvent event) {
if(!date.validate()){
return;
}
RPCS.getReportService().ownerFailJobs(date.getValue(), new AbstractAsyncCallback<List<Map<String,String>>>() {
private DateTimeFormat format=DateTimeFormat.getFormat("yyyy年MM月dd日");
public void onSuccess(final List<Map<String, String>> result) {
final String[] categories=new String[result.size()];
Number[] numbers=new Number[result.size()];
for(int i=0;i<result.size();i++){
Map<String, String> map=result.get(i);
categories[i]=map.get("uname")==null?map.get("uid"):map.get("uname");
numbers[i]=Integer.valueOf(map.get("count"));
}
final Chart chart=new Chart();
chart.setType(Series.Type.COLUMN);
chart.setChartTitleText(format.format(date.getValue())+"责任人失败任务统计图");
chart.setColumnPlotOptions(new ColumnPlotOptions()
.setPointPadding(0.2).setBorderWidth(0))
.setLegend(new Legend()
.setLayout(Legend.Layout.VERTICAL)
.setAlign(Legend.Align.LEFT)
.setVerticalAlign(VerticalAlign.TOP)
.setX(100)
.setY(70)
.setFloating(true)
.setBackgroundColor("#FFFFFF")
.setShadow(true)).setColors("#3399ff","#ff6600") //"#4572A7","#AA4643"
.setToolTip(new ToolTip()
.setFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
int index=0;
for(int i=0;i<categories.length;i++){
if(categories[i].equals(toolTipData.getXAsString())){
index=i;
break;
}
}
String value= toolTipData.getYAsLong()+"个任务<br/>";
int count=Integer.valueOf(result.get(index).get("count"));
if(count>0){
for(int i=0;i<count;i++){
value+=result.get(index).get("history"+i)+"<br/>";
}
}
index++;
return value;
}
}));
chart.getXAxis().setCategories(categories);
chart.getYAxis().setAxisTitleText("失败任务数");
chart.addSeries(chart.createSeries().setName("失败的任务")
.setPoints(numbers));
for(int i=0;i<container.getWidgetCount();i++){
if(container.getWidget(i) instanceof Chart){
container.remove(container.getWidget(i));
break;
}
}
container.add(chart,new VerticalLayoutData(1, -1));
}
});
}
示例3: onSelect
import org.moxieapps.gwt.highcharts.client.Legend; //导入依赖的package包/类
@Override
public void onSelect(SelectEvent event) {
if(start.getValue()==null){
start.markInvalid("请正确填写");
return;
}
if(end.getValue()==null || end.getValue().after(new Date())){
end.markInvalid("请正确填写");
return;
}
if(start.getValue().after(end.getValue())){
start.markInvalid("开始日期必须小于截止日期");
return;
}
if(end.getValue().getTime()-start.getValue().getTime()>15*24*60*60*1000L){
start.markInvalid("开启截止区间太大,请设置在2周以内");
return;
}
Date endDate=new Date(end.getValue().getTime());
endDate.setHours(23);
endDate.setMinutes(59);
RPCS.getReportService().runningJobs(start.getValue(), endDate, new AbstractAsyncCallback<List<Map<String,String>>>() {
public void onSuccess(List<Map<String, String>> result) {
String[] categories=new String[result.size()];
Number[] successNum=new Number[result.size()];
Number[] failNum=new Number[result.size()];
for(int i=0;i<result.size();i++){
Map<String, String> map=result.get(i);
categories[i]=map.get("date");
successNum[i]=map.get("success")==null?0:Integer.valueOf(map.get("success"));
failNum[i]=map.get("fail")==null?0:Integer.valueOf(map.get("fail"));
}
final Chart chart=new Chart();
chart.setType(Series.Type.COLUMN);
chart.setChartTitleText("运行任务趋势图");
chart.setColumnPlotOptions(new ColumnPlotOptions()
.setPointPadding(0.2).setBorderWidth(0))
.setLegend(new Legend()
.setLayout(Legend.Layout.VERTICAL)
.setAlign(Legend.Align.LEFT)
.setVerticalAlign(VerticalAlign.TOP)
.setX(100)
.setY(70)
.setFloating(true)
.setBackgroundColor("#FFFFFF")
.setShadow(true)).setColors("#3399ff","#ff6600") //"#4572A7","#AA4643"
.setToolTip(new ToolTip()
.setFormatter(new ToolTipFormatter() {
@Override
public String format(ToolTipData toolTipData) {
return toolTipData.getSeriesName()+": "+toolTipData.getYAsLong()+"";
}
}));
chart.getXAxis().setCategories(categories);
chart.getYAxis().setAxisTitleText("任务数量");
chart.addSeries(chart.createSeries().setName("成功的任务")
.setPoints(successNum));
chart.addSeries(chart.createSeries().setName("失败的任务")
.setPoints(failNum));
for(int i=0;i<container.getWidgetCount();i++){
if(container.getWidget(i) instanceof Chart){
container.remove(container.getWidget(i));
break;
}
}
container.add(chart,new VerticalLayoutData(1, -1));
}
});
}
示例4: onSelect
import org.moxieapps.gwt.highcharts.client.Legend; //导入依赖的package包/类
public void onSelect(SelectEvent event) {
if(!date.validate()){
return;
}
RPCS.getReportService().ownerFailJobs(date.getValue(), new AbstractAsyncCallback<List<Map<String,String>>>() {
private DateTimeFormat format=DateTimeFormat.getFormat("yyyy年MM月dd日");
public void onSuccess(final List<Map<String, String>> result) {
final String[] categories=new String[result.size()];
Number[] numbers=new Number[result.size()];
for(int i=0;i<result.size();i++){
Map<String, String> map=result.get(i);
categories[i]=map.get("uname")==null?map.get("uid"):map.get("uname");
numbers[i]=Integer.valueOf(map.get("count"));
}
final Chart chart=new Chart();
chart.setType(Series.Type.COLUMN);
chart.setChartTitleText(format.format(date.getValue())+"责任人失败任务统计图");
chart.setColumnPlotOptions(new ColumnPlotOptions()
.setPointPadding(0.2).setBorderWidth(0))
.setLegend(new Legend()
.setLayout(Legend.Layout.VERTICAL)
.setAlign(Legend.Align.LEFT)
.setVerticalAlign(VerticalAlign.TOP)
.setX(100)
.setY(70)
.setFloating(true)
.setBackgroundColor("#FFFFFF")
.setShadow(true))
.setToolTip(new ToolTip()
.setFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
int index=0;
for(int i=0;i<categories.length;i++){
if(categories[i].equals(toolTipData.getXAsString())){
index=i;
break;
}
}
String value= toolTipData.getYAsLong()+"个任务<br/>";
int count=Integer.valueOf(result.get(index).get("count"));
if(count>0){
for(int i=0;i<count;i++){
value+=result.get(index).get("history"+i)+"<br/>";
}
}
index++;
return value;
}
}));
chart.getXAxis().setCategories(categories);
chart.getYAxis().setAxisTitleText("失败任务数");
chart.addSeries(chart.createSeries().setName("失败的任务")
.setPoints(numbers));
for(int i=0;i<container.getWidgetCount();i++){
if(container.getWidget(i) instanceof Chart){
container.remove(container.getWidget(i));
break;
}
}
container.add(chart,new VerticalLayoutData(1, -1));
}
});
}
示例5: onSelect
import org.moxieapps.gwt.highcharts.client.Legend; //导入依赖的package包/类
@Override
public void onSelect(SelectEvent event) {
if(start.getValue()==null){
start.markInvalid("请正确填写");
return;
}
if(end.getValue()==null || end.getValue().after(new Date())){
end.markInvalid("请正确填写");
return;
}
if(start.getValue().after(end.getValue())){
start.markInvalid("开始日期必须小于截止日期");
return;
}
if(end.getValue().getTime()-start.getValue().getTime()>15*24*60*60*1000L){
start.markInvalid("开启截止区间太大,请设置在2周以内");
return;
}
Date endDate=new Date(end.getValue().getTime());
endDate.setHours(23);
endDate.setMinutes(59);
RPCS.getReportService().runningJobs(start.getValue(), endDate, new AbstractAsyncCallback<List<Map<String,String>>>() {
public void onSuccess(List<Map<String, String>> result) {
String[] categories=new String[result.size()];
Number[] successNum=new Number[result.size()];
Number[] failNum=new Number[result.size()];
for(int i=0;i<result.size();i++){
Map<String, String> map=result.get(i);
categories[i]=map.get("date");
successNum[i]=map.get("success")==null?0:Integer.valueOf(map.get("success"));
failNum[i]=map.get("fail")==null?0:Integer.valueOf(map.get("fail"));
}
final Chart chart=new Chart();
chart.setType(Series.Type.COLUMN);
chart.setChartTitleText("运行任务趋势图");
chart.setColumnPlotOptions(new ColumnPlotOptions()
.setPointPadding(0.2).setBorderWidth(0))
.setLegend(new Legend()
.setLayout(Legend.Layout.VERTICAL)
.setAlign(Legend.Align.LEFT)
.setVerticalAlign(VerticalAlign.TOP)
.setX(100)
.setY(70)
.setFloating(true)
.setBackgroundColor("#FFFFFF")
.setShadow(true))
.setToolTip(new ToolTip()
.setFormatter(new ToolTipFormatter() {
@Override
public String format(ToolTipData toolTipData) {
return toolTipData.getYAsLong()+"";
}
}));
chart.getXAxis().setCategories(categories);
chart.getYAxis().setAxisTitleText("数量");
chart.addSeries(chart.createSeries().setName("成功的任务")
.setPoints(successNum));
chart.addSeries(chart.createSeries().setName("失败的任务")
.setPoints(failNum));
for(int i=0;i<container.getWidgetCount();i++){
if(container.getWidget(i) instanceof Chart){
container.remove(container.getWidget(i));
break;
}
}
container.add(chart,new VerticalLayoutData(1, -1));
}
});
}