欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android圖表之-Echarts-創(chuàng)新互聯(lián)

ECharts是一款開源、功能強(qiáng)大的數(shù)據(jù)可視化產(chǎn)品,緊跟著大數(shù)據(jù)時代的步伐,是我接觸過的最優(yōu)秀的可視化工具,也是進(jìn)步最快的軟件,希望它早日成為世界級的開源項(xiàng)目,之前使用過MPAndroidChart,achartengine 等android下的圖形圖標(biāo),相對而言Echart樣式更多,通過JS的形式來實(shí)現(xiàn)還是第一次見 ,話不多說直接上代碼

專注于為中小企業(yè)提供網(wǎng)站設(shè)計(jì)制作、做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)古交免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

 1.布局文件比較簡單定時3個Button ,和一個Webview :

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

  xmlns:tools="http://schemas.android.com/tools"

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:paddingBottom="@dimen/activity_vertical_margin"

  android:paddingLeft="@dimen/activity_horizontal_margin"

  android:paddingRight="@dimen/activity_horizontal_margin"

  android:paddingTop="@dimen/activity_vertical_margin"

  tools:context="com.hzbst.echartst.MainActivity" >

<LinearLayout

   android:id="@+id/bt_ly"

   android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:gravity="center_horizontal"

   >

<Button

   android:id="@+id/linechart_bt"

   android:layout_width="match_parent"

   android:layout_height="wrap_content"

   android:layout_weight="1"

   android:text="折線圖" />

<Button

   android:id="@+id/barchart_bt"

   android:layout_width="match_parent"

   android:layout_height="wrap_content"

   android:layout_weight="1"

   android:text="柱狀圖" />

<Button

   android:id="@+id/piechart_bt"

   android:layout_width="match_parent"

   android:layout_height="wrap_content"

   android:layout_weight="1"

   android:text="餅狀圖" />

</LinearLayout>

<WebView

   android:id="@+id/chartshow_wb"

   android:layout_width="match_parent"

   android:layout_height="match_parent"

   android:layout_alignRight="@+id/bt_ly"

   android:layout_below="@+id/bt_ly"

   android:layout_marginTop="43dp" />

</RelativeLayout>

2. 在代碼中去架子Echarts圖形

 MainActivity類

找到Webview,然后設(shè)置一些屬性

chartshow_wb=(WebView)findViewById(R.id.chartshow_wb);

//進(jìn)行webwiev的一堆設(shè)置

//開啟本地文件讀取(默認(rèn)為true,不設(shè)置也可以)

chartshow_wb.getSettings().setAllowFileAccess(true);

//開啟腳本支持

chartshow_wb.getSettings().setJavaScriptEnabled(true);

chartshow_wb.getSettings().setSupportZoom(true);

chartshow_wb.getSettings().setBuiltInZoomControls(true);

chartshow_wb.loadUrl("file:///android_asset/echart/myechart.html");

通過loadUrl加載,myecharts文件

mycharts文件保存在assets目錄下

通過三個按鈕來切換不同的視圖 :

折線圖調(diào)用:chartshow_wb.loadUrl("javascript:createChart('line',[29.2,29.2,29.2,29.2,29.2,29.1,29.1,]," +

"['2017-05-22','2017-05-22','2017-05-22','2017-05-22','2017-05-22','2017-05-22','2017-05-22',]);"); 上面有兩個參數(shù),分別為X,y軸對應(yīng)的數(shù)據(jù)

其他兩個 :

chartshow_wb.loadUrl("javascript:createChart('bar',[100,100,100]);");

chartshow_wb.loadUrl("javascript:createChart('pie",[100,100,100]);");

這樣就可以了

源代碼下載地址:http://down.51cto.com/data/2309209

附件:http://down.51cto.com/data/2366697

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

文章題目:Android圖表之-Echarts-創(chuàng)新互聯(lián)
當(dāng)前路徑:http://chinadenli.net/article42/eooec.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)響應(yīng)式網(wǎng)站網(wǎng)頁設(shè)計(jì)公司網(wǎng)站營銷網(wǎng)站策劃企業(yè)網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司