123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Web.UI;
- //using myChart.WebCharts.Insight;
- using SysBaseLibs;
- using System.Drawing;
- using AjaxControlToolkit;
- namespace SysDataLibs.Charts
- {
- public class CheckDataCharts
- {
- public static void ShowPicture(string pcType,string pcReportType, Page poPage)
- {
- pcType = UtilStr.UAndT(pcType);
- switch (pcType)
- {
- case "PIE"://显示饼图
- ShowPieChart(poPage,pcReportType );
- break;
- case "BAR"://显示柱图
- ShowBarChart(poPage,pcReportType );
- break;
- case "LINES": //线性统计图
- break;
- case "LINE": //显示实时线图
- break;
-
- case "0"://测试柱图
- ShowPicture0(poPage);
- break;
- case "1"://测试饼图
- ShowPicture1(poPage);
- break;
- case "2"://测试实时图
- ShowPicture2(poPage);
- break;
- default:
- break;
- }
- }
- private static void ShowBarChart(Page poPage,string pcReportType)
- {
- UserSession _Session = WebLibs.CheckLogin();
- //string SearchStr = _Session.GetObj("SearchStr").ToString();
- string lcSql = _Session.GetObj("SearchStr").ToString();//" select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
- rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
- BarChart loBarChart = new BarChart();
- loBarChart.SetDataToDataObj(loQuery);
- loBarChart.SubTitleVisable = true;
-
- switch (pcReportType)
- {
- case "MONTHCount":
- loBarChart.DrawChart("月统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "YEARCount":
- loBarChart.DrawChart("年统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "ProduceUnit":
- loBarChart.DrawChart("生产单位统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "SampleName":
- loBarChart.DrawChart("检测样品统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case"LittleKindName":
- loBarChart.DrawChart("食品小类统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
-
- case "CheckProjectTypeID":
- loBarChart.DrawChart("检测项目统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "CheckUnit":
- loBarChart.DrawChart("检测单位统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- //------------------------------合格率---------------------------------
- case "MonthHGL":
- loBarChart.IsHeGeLv = true ;
- loBarChart.DrawChart("月合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "YearHGL":
- loBarChart.IsHeGeLv = true;
- loBarChart.DrawChart("年合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "CheckProjectTypeHGL":
- loBarChart.IsHeGeLv = true;
- loBarChart.DrawChart("检测项目合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "ProduceUnitHGL":
- loBarChart.IsHeGeLv = true;
- loBarChart.DrawChart("生产单位合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- //
- case "SampleNameHGL":
- loBarChart.IsHeGeLv = true;
- loBarChart.DrawChart("检测样品合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "CheckUnitHGL":
- loBarChart.IsHeGeLv = true;
- loBarChart.DrawChart("检测单位合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "LittleKindNameHGL":
- loBarChart.IsHeGeLv = true;
- loBarChart.DrawChart("食品小类合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
- break;
- default :
- break;
- }
- }
- private static void ShowPieChart(Page poPage,string pcReportType)
- {
- UserSession _Session = WebLibs.CheckLogin();
- string lcSql = _Session.GetObj("SearchStr").ToString();// " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
- rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
- PieChart loPieChart = new PieChart();
- loPieChart.SetDataToDataObj(loQuery);
- loPieChart.SubTitleVisable = true;
-
- switch (pcReportType)
- {
- case "MONTHCount":
- loPieChart.DrawChart("月统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "YEARCount":
- loPieChart.DrawChart("年统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "ProduceUnit":
- loPieChart.DrawChart("生产单位统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "SampleName":
- loPieChart.DrawChart("检测样品统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "LittleKindName":
- loPieChart.DrawChart("食品小类统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- //case "GreatKindName":
- // loPieChart.DrawChart("食品大类统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- // break;
- case "CheckProjectTypeID":
- loPieChart.DrawChart("检测项目统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- case "CheckUnit":
- loPieChart.DrawChart("检测单位统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
- break;
- default:
- break;
- }
- }
- private static void ShowLineChart(Page poPage)
- {
- }
- private static void ShowPicture0(Page poPage)
- {
- UserSession _Session = WebLibs.CheckLogin();
- string lcSql = " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
- rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
- BarChart loBarChart = new BarChart();
- loBarChart.SetDataToDataObj(loQuery);
- loBarChart.SubTitleVisable = true;
- loBarChart.DrawChart("yue统计柱图", "副标题", new Size(500, 400), poPage.Response.OutputStream);
- }
- private static void ShowPicture1(Page poPage)
- {
- UserSession _Session = WebLibs.CheckLogin();
- string lcSql = " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
- rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
- PieChart loPieChart = new PieChart();
- loPieChart.SetDataToDataObj(loQuery);
- loPieChart.SubTitleVisable = true;
- loPieChart.DrawChart("品种类型统计饼图", "副标题", new Size(500, 400), poPage.Response.OutputStream);
- }
- private static void ShowPicture2(Page poPage)
- {
- UserSession _Session = WebLibs.CheckLogin();
- string lcSql = " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
- rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
- LineChart loLineChart = new LineChart();
- loLineChart.SetDataToDataObj(loQuery);
- loLineChart.SubTitleVisable = true;
- loLineChart.DrawChart("食品安全日实时走势图", "副标题", new Size(500, 400), poPage.Response.OutputStream);
- }
- }
- }
|