图片1(类别):
图片中的数据是我一月的花费统计分析、
这是该网站的地址:http://www.10086bank.com/(需要登录) 没有帐号马上注册一个吧、进入系统后点击“记一笔” 添加数据即可! 类别查询和详细查询!
PC端日程:
android版在这里:
android版调用站点中的webservice的功能 先上图:
// 判断是否网络连接 有返回true 失败返回false public static boolean isNetworkConnected(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mNetworkInfo = mConnectivityManager .getActiveNetworkInfo(); if (mNetworkInfo != null) { return mNetworkInfo.isAvailable(); } } return false; }
实现android判断当前是否有网络连接的代码。
登录成功进入主界面了:
这里是android调用webservice的代码:
//点击查询按钮获取当天数据 private ArrayList<HashMap<String, String>> GetThisMonthDataByUsercodeDetail(int year,int month,int day){ ArrayList<HashMap<String, String>> list=null; SoapObject soapObject = new SoapObject(Competence.NAMESPACE, method_GetThisMonthDataByUsercodeDetail); soapObject.addProperty("year", year); soapObject.addProperty("month", month); soapObject.addProperty("day", day); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.bodyOut = soapObject; HttpTransportSE ht = new HttpTransportSE(Competence.URLs); try { ht.debug = true; ht.reset(); ht.call(Competence.NAMESPACE+method_GetThisMonthDataByUsercodeDetail, envelope); SoapObject result=(SoapObject)envelope.getResponse(); int count=result.getPropertyCount(); if(count>1){ list=new ArrayList<HashMap<String, String>>(); for (int i = 0; i < count; i=i+2) { HashMap<String, String> map = new HashMap<String, String>(); map.put("ItemTitle", result.getProperty(i).toString()); map.put("ItemText", result.getProperty(i+1).toString()); list.add(map); } } } catch (Exception e) { // TODO: handle exception } return list; }
然后调用
//绑定数据 private void OnDataToListView(ArrayList<HashMap<String, String>> mylist){ if (mylist!=null) { ListView list = (ListView) findViewById(R.id.MyListView); SimpleAdapter mSchedule = new SimpleAdapter(DataManager.this,mylist,R.layout.my_listitem,new String[] {"ItemTitle", "ItemText"},new int[] {R.id.ItemTitle,R.id.ItemText}); list.setAdapter(mSchedule); mSchedule=null; list=null; } else { Mesg("没有数据!"); } }
以上android调用10086bank.com
PC端用到了柱状图和饼状图分析功能、使用的是jquery图表插件工具highcharts (点击进入可下载js包),
下面是主要的js代码:
if (temps != "") { $("select[myenumid='" + myenumid + "']").parent().children().remove('div'); $("select[myenumid='" + myenumid + "']").removeClass(); $("select[myenumid='" + myenumid + "']").html(""); $("select[myenumid='" + myenumid + "']").append(temps); $("select[myenumid='" + myenumid + "']").chosen(); } myenumid = null; temps = null; for (var i = 0; i < obj.length; i++) { data1.push(obj[i].LAB); data2.push(parseFloat(obj[i].DAT)); summoney = parseFloat(summoney) + parseFloat(obj[i].DAT); var one = []; one[0] = obj[i].LAB; one[1] = parseInt(obj[i].DAT); data.push(one); one = null; }
数据格式使用的是json格式,一个很厉害的数据传输格式。
页面中还用到children页面美化:
//填充 var isfull = 1; function fulldata() { if (isfull == 1) return; var myenumid = "myenumid007"; $("select[myenumid='" + myenumid + "']").parent().children().remove('div'); $("select[myenumid='" + myenumid + "']").removeClass(); $("select[myenumid='" + myenumid + "']").html(""); $("select[myenumid='" + myenumid + "']").append("<option value='食'>食</option>"); $("select[myenumid='" + myenumid + "']").append("<option value='衣'>衣</option>"); $("select[myenumid='" + myenumid + "']").append("<option value='住'>住</option>"); $("select[myenumid='" + myenumid + "']").append("<option value='用'>用</option>"); $("select[myenumid='" + myenumid + "']").append("<option value='行'>行</option>"); $("select[myenumid='" + myenumid + "']").append("<option value='其它'>其它</option>"); $("select[myenumid='" + myenumid + "']").chosen(); $("select[myenumid='" + myenumid + "']").parent().children().children("a").attr("class", "chzn-single chzn-single-with-drop"); $("select[myenumid='" + myenumid + "']").parent().children().children("div").attr("style", "left:0px;top:24px"); $("select[myenumid='" + myenumid + "']").parent().children().children("div").children("div").children().focus(); $("select[myenumid='" + myenumid + "']").parent().children().children("div").children("ul").children("li:first-child").attr("class", "active-result result-selected highlighted"); myenumid = null; }
代码实现起来是很容易的、
PAK下载
PC端(100086bank.com)
文采有限、写不出好的东西、但有一颗自信的心!
谢谢!