欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

google js 實(shí)現(xiàn)Dashboard

系統(tǒng) 2127 0

???? 通過(guò)Google Chart Tools提供的圖表功能實(shí)現(xiàn)如下:

? 地址如下:

? http://code.google.com/intl/zh-CN/apis/chart/interactive/docs/gallery/gauge.html

?

效果如下圖:

google js 實(shí)現(xiàn)Dashboard

代碼如下:

<html> ?
?
<head> ?
? ?
<script type = 'text/javascript' src = 'https://www.google.com/jsapi' ></script> ?
? ?
<script type = 'text/javascript' > ?
? ? ? google
. load ( 'visualization' , '1' , { packages :[ 'gauge' ]}); ?
? ? ? google
. setOnLoadCallback ( drawChart ); ?
? ? ?
function drawChart () { ?
? ? ? ?
var data = new google . visualization . DataTable (); ?
? ? ? ? data
. addColumn ( 'string' , 'Label' ); ?
? ? ? ? data
. addColumn ( 'number' , 'Value' ); ?
? ? ? ? data
. addRows ([ ?
? ? ? ? ?
[ 'Memory' , 80 ], ?
? ? ? ? ?
[ 'CPU' , 55 ], ?
? ? ? ? ?
[ 'Network' , 68 ] ?
? ? ? ?
]); ?
?
? ? ? ?
var options = { ?
? ? ? ? ? width
: 400 , height : 120 , ?
? ? ? ? ? redFrom
: 90 , redTo : 100 , ?
? ? ? ? ? yellowFrom
: 75 , yellowTo : 90 , ?
? ? ? ? ? minorTicks
: 5 ?
? ? ? ?
}; ?
?
? ? ? ?
var chart = new google . visualization . Gauge ( document . getElementById ( 'chart_div' )); ?
? ? ? ? chart
. draw ( data , options ); ?
? ? ?
} ?
? ?
</script> ?
?
</head> ?
?
<body> ?
? ?
<div id = 'chart_div' ></div> ?
?
</body> ?
</html>

?

Loading

The google.load package name is "gauge"

? google . load ( 'visualization' , '1' , { packages : [ 'gauge' ]});
  

The visualization's class name is google.visualization.Gauge

? var visualization = new google . visualization . Gauge ( container );
  

Data Format

Each numeric value is displayed as a gauge. Two alternative data formats are supported:

  1. Two columns. The first column should be a string, and contain the gauge label. The second column should be a number, and contain the gauge value.
  2. Any number of numeric columns. The label of each gauge is the column's label.

Configuration Options

?

Name Type Default Description
animation.duration number 400 The duration of the animation, in milliseconds. For details, see the animation documentation .
animation.easing string 'linear' The easing function applied to the animation. The following options are available:
  • 'linear' - Constant speed.
  • 'in' - Ease in - Start slow and speed up.
  • 'out' - Ease out - Start fast and slow down.
  • 'inAndOut' - Ease in and out - Start slow, speed up, then slow down.
greenColor string '#109618' The color to use for the green section, in HTML color notation.
greenFrom number none The lowest value for a range marked by a green color.
greenTo number none The highest value for a range marked by a green color.
height number Container's width Height of the chart in pixels.
majorTicks Array of strings none Labels for major tick marks. The number of labels define the number of major ticks in all gauges. The default is five major ticks, with the labels of the minimal and maximal gauge value.
max number 100 The maximal value of a gauge.
min number 0 The minimal value of a gauge.
minorTicks number 2 The number of minor tick section in each major tick section.
redColor string '#DC3912' The color to use for the red section, in HTML color notation.
redFrom number none The lowest value for a range marked by a red color.
redTo number none The highest value for a range marked by a red color.
width number Container's width Width of the chart in pixels.
yellowColor string '#FF9900' The color to use for the yellow section, in HTML color notation.
yellowFrom number none The lowest value for a range marked by a yellow color.
yellowTo number none The highest value for a range marked by a yellow color.

Methods

?

Method Return Type Description
draw(data, options) none Draws the chart.
clearChart() none Clears the chart, and releases all of its allocated resources.

Events

No triggered events.

?

?

?

?

?

?Java 實(shí)現(xiàn)DashBoard:

google js 實(shí)現(xiàn)Dashboard

?

    package com.easyway.dashbroad;

import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Point;
import java.io.FileOutputStream;
import java.io.IOException;

import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.dial.DialBackground;
import org.jfree.chart.plot.dial.DialCap;
import org.jfree.chart.plot.dial.DialPlot;
import org.jfree.chart.plot.dial.DialTextAnnotation;
import org.jfree.chart.plot.dial.DialValueIndicator;
import org.jfree.chart.plot.dial.StandardDialFrame;
import org.jfree.chart.plot.dial.StandardDialRange;
import org.jfree.chart.plot.dial.StandardDialScale;
import org.jfree.data.general.DefaultValueDataset;
import org.jfree.ui.GradientPaintTransformType;
import org.jfree.ui.StandardGradientPaintTransformer;
/**
 * 
 * @Title: 
 * @Description: JFreeChart實(shí)現(xiàn)Dashboard功能
 * @Copyright:Copyright (c) 2011
 * @Company:易程科技股份有限公司
 * @Date:2011-4-11
 * @author  longgangbai
 * @version 1.0
 */
public class DashboardApp {

	public String getDial(String warnName,double warnValue) {  
			// 數(shù)據(jù)集合對(duì)象 此處為DefaultValueDataset  
			DefaultValueDataset dataset = new DefaultValueDataset();  
			// 當(dāng)前指針指向的位置,即:我們需要顯示的數(shù)據(jù)  
			dataset = new DefaultValueDataset(warnValue);  
			// 實(shí)例化DialPlot  
			DialPlot dialplot = new DialPlot();  
			dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D);  
			// 設(shè)置數(shù)據(jù)集合  
			dialplot.setDataset(dataset);  
			// 開(kāi)始設(shè)置顯示框架結(jié)構(gòu)  
			StandardDialFrame simpledialframe = new StandardDialFrame();  
			simpledialframe.setBackgroundPaint(Color.lightGray);//Color.lightGray //儀表盤(pán)邊框內(nèi)部顏色  
			simpledialframe.setForegroundPaint(Color.darkGray);//Color.darkGray //儀表盤(pán)邊框外部顏色  
			dialplot.setDialFrame(simpledialframe);  
			// 結(jié)束設(shè)置顯示框架結(jié)構(gòu),表盤(pán)顏色 從最上部 白色 過(guò)渡到最下部的藍(lán)色  
			GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(229,229,229), new Point(), new Color(229,229,229));  
			DialBackground dialbackground = new DialBackground(gradientpaint);  
			dialbackground.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));  
			dialplot.setBackground(dialbackground);  
			// 設(shè)置顯示在表盤(pán)中央位置的信息  
			DialTextAnnotation dialtextannotation = new DialTextAnnotation(warnName);  
			dialtextannotation.setFont(new Font("宋體", 1, 16));  
			dialtextannotation.setRadius(0.69999999999999996D);  
			dialplot.addLayer(dialtextannotation);  

		// 設(shè)置刻度范圍(綠色)  
		if(warnValue==0){  
			StandardDialRange standarddialrange2 = new StandardDialRange(0D, 100D,Color.green);  
			standarddialrange2.setInnerRadius(0.52000000000000002D);  
			standarddialrange2.setOuterRadius(0.55000000000000004D);  
			dialplot.addLayer(standarddialrange2);   
		}else if(warnValue>0&&warnValue<=100){// 設(shè)置刻度范圍(橘黃色)  
			StandardDialRange standarddialrange1 = new StandardDialRange(0D, 100D,Color.orange);  
			standarddialrange1.setInnerRadius(0.52000000000000002D);  
			standarddialrange1.setOuterRadius(0.55000000000000004D);  
			dialplot.addLayer(standarddialrange1);  
		}else if(warnValue>100&&warnValue<=1000){// 設(shè)置刻度范圍(紅色)   
			StandardDialRange standarddialrange = new StandardDialRange(0D, 1000D,Color.red);  
			standarddialrange.setInnerRadius(0.52000000000000002D);  
			standarddialrange.setOuterRadius(0.55000000000000004D);  
			dialplot.addLayer(standarddialrange);  
		}else if(warnValue>1000){// 設(shè)置刻度范圍(紅色)   
			StandardDialRange standarddialrange = new StandardDialRange(0D, 10000D,Color.red);  
			standarddialrange.setInnerRadius(0.52000000000000002D);  
			standarddialrange.setOuterRadius(0.55000000000000004D);  
			dialplot.addLayer(standarddialrange);  
		}  

		//指針指示框 ,儀表盤(pán)中間的小方框  
		DialValueIndicator dialvalueindicator = new DialValueIndicator(0);  
		dialvalueindicator.setFont(new Font("宋體", 1, 14));   
		dialvalueindicator.setOutlinePaint(new Color(229,229,229));  
		dialvalueindicator.setBackgroundPaint(new Color(229,229,229));  
		dialvalueindicator.setRadius(0.39999999999999998D);  
		//dialvalueindicator.setPaint(Color.red);  
		dialplot.addLayer(dialvalueindicator);  
		/*  
		* StandardDialScale 方法  
		* 參數(shù)1 開(kāi)始數(shù)值 類(lèi)似手表 開(kāi)始 0點(diǎn)  
		* 參數(shù)2 結(jié)束數(shù)值 類(lèi)似手表 結(jié)束 12點(diǎn)  
		* 參數(shù)5 間隔差值 類(lèi)似手表 間隔差值5分鐘  
		* 參數(shù)6 間隔數(shù)量 類(lèi)似手表 1點(diǎn)到2點(diǎn) 有4個(gè)間隔點(diǎn)  
		*/ 
		        //如果 預(yù)警條數(shù)少于 100條,開(kāi)度從 0 至 100 ,間隔 10  
		double startPosition=0D; //開(kāi)度 0  
        double endPosition=100D; //開(kāi)度 100  
        double skipValue=10D; //間隔 10  
        if(warnValue>100&&warnValue<1000){  
           endPosition=1000D;  
           skipValue=100D;  
        }else if(warnValue>=1000){  
            endPosition=10000D;  
            skipValue=1000D;  
        }  
		//刻度盤(pán)設(shè)置  
		StandardDialScale standarddialscale = new StandardDialScale(startPosition, endPosition,-120D, -300D, skipValue, 4);  
		standarddialscale.setTickRadius(0.88D);//設(shè)置半徑  
		standarddialscale.setTickLabelOffset(0.14999999999999999D);  
		standarddialscale.setTickLabelFont(new Font("Dialog", 0, 10));//刻度盤(pán)數(shù)字大小  

		// 注意是 dialplot.addScale()不是dialplot.addLayer()  
		dialplot.addScale(0, standarddialscale);  

		// 設(shè)置指針  
		org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer();  
		dialplot.addLayer(pointer);  
		// 實(shí)例化DialCap  
		DialCap dialcap = new DialCap();  
		dialcap.setRadius(0.10000000000000001D);  
		dialplot.setCap(dialcap);  
		// 生成chart對(duì)象  
		JFreeChart jfreechart = new JFreeChart(dialplot);  
		// 3、設(shè)定參數(shù)輸出結(jié)果,首先在 項(xiàng)目/WEB-INF/classes/,添加WarnImages文件夾  
		String filePath="D:/"+System.currentTimeMillis()+".jpeg";//動(dòng)態(tài)文件名 相對(duì)  
		FileOutputStream file = null;  
		try {  
		file = new FileOutputStream(filePath);  
		ChartUtilities.writeChartAsJPEG(file, 1.0f, jfreechart, 200, 200,null);//200,200 圖片大小  
		} catch (IOException e) {  
		e.printStackTrace();  
		} // 生成圖片  
		finally {  
		try {  
		file.close();// 最后關(guān)閉文件流  
		} catch (IOException e) {  
		e.printStackTrace();  
		}  
		}  
		return filePath;
		}  
		public static void main(String[] args) {  
		  System.out.println(new DashboardApp().getDial("測(cè)試預(yù)警",80.0));  
		}
}



  

?

google js 實(shí)現(xiàn)Dashboard


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦?。?!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 成人国产一区二区三区 | 瑟瑟综合 | 欧美日一区二区三区 | 91精品综合久久久久久五月天 | 成人免费视频网址 | 台湾三级无遮挡在线播放 | 亚洲欧美日韩三级 | 日韩精品久久久久久久电影 | 欧美一区免费 | 久久这里只有精品免费看青草 | 欧美精品福利 | 夜班护士与医生啪 | 亚洲成网站www久久九 | 欧美在线一区二区三区欧美 | 国产亚洲精品精品国产亚洲综合 | 国产一区中文字幕 | 精品日韩欧美国产一区二区 | 激情五月综合 | 精品欧美成人高清视频在线观看 | 免费一二区 | 日本伦理网站 | 九九九九精品视频在线播放 | 国产精品爱久久久久久久电影 | 日本三级理论 | 亚洲国产精品日韩高清秒播 | 欧美在线视频一区二区三区 | 色诱成人免费观看视频 | 日韩一区二区中文字幕 | 国产精品揄拍100视频最近 | 在线欧美 | 色一区二区 | 亚洲最黄网站 | 日韩在线免费 | 天天爱夜夜| 首页亚洲国产丝袜长腿综合 | 亚洲精品一区二区三区在线 | 免费精品美女久久久久久久久久 | 日韩欧美一区二区三区视频 | 国产午夜精品一区二区三区 | 欧美十区 | 欧美三级中文字幕hd |