用Java从XML文件中获取业务图表 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-23
rrent = strSeriesTitles.substring(nCurrentLoc,nLoc); strSeriesTitles = strSeriesTitles.substring(nLoc+1,strSeriesTitles.length()); } else { strCurrent = strSeriesTitles; } strSTitles.add(strCurrent); } } private void DoChart() { Node nRoot; Element nElem; int nType; String strTitle; String strCatTitle; String strValTitle; String strSTitleList; nRoot = xmlConfig.getDocumentElement(); nElem = (Element) nRoot; nType = new Integer(GetChildItem(nElem,"Type")).intValue(); strTitle = GetChildItem(nElem,"Title"); strCatTitle = GetChildItem(nElem,"CatTitle"); strValTitle = GetChildItem(nElem, "ValTitle"); strSTitleList = GetChildItem(nElem, "SeriesTitles"); LoadSeriesTitles(strSTitleList); categoryData = createDataset(); switch(nType){ case 0: { chart = ChartFactory.createVerticalBarChart(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 1: { PieDataset pieData = DatasetUtilities.createPieDataset(categoryData, 0); chart = ChartFactory.createPieChart(strTitle, pieData, true); break; } case 2: { chart = ChartFactory.createHorizontalBarChart(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 3: { chart = ChartFactory.createLineChart(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 4: { chart = ChartFactory.createAreaChart(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 5: { chart = ChartFactory.createHorizontalBarChart3D(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 6: { PieDataset pieData = DatasetUtilities.createPieDataset(categoryData, 0); chart = ChartFactory.createPie3DChart(strTitle, pieData, true); break; } case 7: { chart = ChartFactory.createStackedHorizontalBarChart(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 8: { chart = ChartFactory.createStackedVerticalBarChart(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 9: { chart = ChartFactory.createStackedVerticalBarChart3D(strTitle, strCatTitle, strValTitle, categoryData, true); break; } case 10: { chart = ChartFactory.createVerticalBarChart3D(strTitle, strCatTitle, strValTitle, categoryData, true); break; } } setupChart(); } private void setupChart() { Plot theplot = chart.getPlot(); float[][] pntHSBArray = new float[4][3]; pntHSBArray[0] = Color.RGBtoHSB(57,69,148,pntHSBArray[0]); pntHSBArray[1] = Color.RGBtoHSB(255,215,49,pntHSBArray[1]); pntHSBArray[2] = Color.RGBtoHSB(206,207,206,pntHSBArray[2]); pntHSBArray[3] = Color.RGBtoHSB(99,150,255,pntHSBArray[3]); Paint[] myPaintArray = new Paint[] { Color.getHSBColor(pntHSBArray[0][0],pntHSBArray[0][1],pntHSBArray[0][2]), Color.getHSBColor(pntHSBArray[1][0],pntHSBArray[1][1],pntHSBArray[1][2]), Color.getHSBColor(pntHSBArray[2][0],pntHSBArray[2][1],pntHSBArray[2][2]), Color.getHSBColor(pntHSBArray[3][0],pntHSBArray[3][1],pntHSBArray[3][2]), }; theplot.setSeriesPaint(myPaintArray); chart.setBackgroundPaint(Color.white); } private CategoryDataset creat |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于用Java从XML文件中获取业务图表 - 编程入门网的所有评论