/// <summary> /// 数据来源:GDPAPatentChartBaseData /// </summary> /// <param name="context"></param> /// <returns></returns> private ChartJson getChartJsonData(CRBIHttpContextQuery context) { DataTable table = null; ChartJson json = new ChartJson(); json.charttype = context.charttype; json.xAxis.Add(new xAxisItemJson() { categories = new List <string>() { }, crosshair = true }); json.series.Add(new SeriesItemJson("发明")); json.series.Add(new SeriesItemJson("实用新型")); json.series.Add(new SeriesItemJson("外观设计")); json.series.Add(new SeriesItemJson("同比增长")); json.series.Add(new SeriesItemJson("同比增长")); json.series.Add(new SeriesItemJson("同比增长")); //GDPAPatentChartBaseDataQuery query = new GDPAPatentChartBaseDataQuery() //{ // n_PatentStatus = context.type, // d_StartDate = context.startDate, // d_EndDate = context.endDate //}; if (context.isallyear == true) { //getChartJsonData_AllYear(query, json,out table); } else { // getChartJsonData_ThisYear(query, json, out table); } return(json); }
public CRBIDocChartData LoadContent_4_2() { CRBIDocChartData data = new CRBIDocChartData(); //data.AddHeader(new List<string>() { "s", "a", "s" }); //data.ChartCode = ""; //data.ChartType = "pie"; //data.Columns.Add(new CRBIDocChartData.CRBIDocChartDataItem(new List<double>() { 24.0, 26.0, 50.0 }, "rt", 0)); //data.HeaderColumns.Add("sa"); ChartJson json = new ChartJson(); json.chart = true; json.charttype = ""; json.xAxis.Add(new xAxisItemJson() { categories = new List <string>() { "甘肃", "陕西", "山西" }, crosshair = true }); json.series.Add(new SeriesItemJson("蒸发量")); // { data = new List<int>() { 15,17,19 }, data_f = new List<double>() { 15.0,17.0,19.0 } }); json.series.Add(new SeriesItemJson("降水量")); // { data = new List<int>() { 15, 21, 36 }, data_f = new List<double>() { 15.0, 21.0, 36.0 } }); for (int i = 0; i < 3; i++) { json.series[0].data.Add(i + 1); json.series[1].data.Add(i + 2); json.series[0].data_f.Add(i + 1.1); json.series[1].data_f.Add(i + 2.2); } convertJsonToPieData(json, data); return(data); }
/// <summary> /// 数据来源:GDPAPatentChartBaseData /// 历年 /// </summary> /// <param name="context"></param> /// <returns></returns> private void getChartJsonData_AllYear(CRBIHttpContextQuery query, ChartJson json, out DataTable table) { var startYear = 1985; var endYear = 2017;// query.d_EndDate.Year; var zeroYear = 2000; table = new DataTable(); //table = GDPAPatentChartBaseDataAccessor.Instance().loadDataZLSQSLQST_LN(query); //json.series.Add(new SeriesItemJson("总量")); //json.series.Add(new SeriesItemJson("总量增长率")); //string xAxisName = ""; //for (int i = zeroYear; i <= endYear; i++) //{ // if (i <= zeroYear) // { // xAxisName = string.Format("{0}-{1}年", startYear, zeroYear); // json.xAxis[0].categories.Add(xAxisName); // getSeriesDataByPatentType(query.n_PatentType, json, table, i, "(n_PatentType ={0} )And ((n_Year>=1985)And (n_Year<={1}))",true); // } // else // { // xAxisName = string.Format("{0}年", i); // json.xAxis[0].categories.Add(xAxisName); // getSeriesDataByPatentType(query.n_PatentType, json, table, i, "(n_PatentType ={0} )And (n_Year={1})", true); // } //} //统计总量 //for (int i = 0; i < json.series[0].data.Count; i++) //{ // var sum = json.series[0].data[i] + json.series[1].data[i] + json.series[2].data[i]; // var szzl = json.series[0].data_f[i] + json.series[1].data_f[i] + json.series[2].data_f[i]; // json.series[3].data.Add(sum); // json.series[3].data_f.Add(szzl); //} }
/// <summary> /// 数据来源:GDPAPatentChartBaseData /// 当年 /// </summary> /// <param name="context"></param> /// <returns></returns> private void getChartJsonData_ThisYear(CRBIHttpContextQuery query, ChartJson json, out DataTable table) { table = new DataTable(); //table = GDPAPatentChartBaseDataAccessor.Instance().loadDataZLSQSLQST_Y(query); //for (int i = query.d_StartDate.Month; i <= query.d_EndDate.Month; i++) //{ // string month = (i < 10) ? string.Format("0{0}月", i) : string.Format("{0}月", i); // json.xAxis[0].categories.Add(month); // getSeriesDataByPatentType(query.n_PatentType, json, table, i, "(n_PatentType ={0})And (n_Month={1})"); //} }
/// <summary> /// 区域级综合保障能力 /// </summary> /// <param name="context"></param> /// <returns></returns> private ChartJson get_A_ZHBBNL_SQJsonData(CRBIHttpContextQuery context) { ChartJson json = new ChartJson(); json.charttype = context.charttype; json.xAxis.Add(new xAxisItemJson() { categories = new List <string>() { }, crosshair = true }); return(json); }
public CRBIDocChartData LoadContent_4_3() { CRBIDocChartData data = new CRBIDocChartData(); //data.AddHeader(new List<string>() { "s", "a", "s" }); //data.ChartCode = ""; //data.ChartType = "pie"; //data.Columns.Add(new CRBIDocChartData.CRBIDocChartDataItem(new List<double>() { 24.0, 26.0, 50.0 }, "rt", 0)); //data.HeaderColumns.Add("sa"); ChartJson json = new ChartJson(); json.chart = true; json.charttype = "bar"; json.series = new List <SeriesItemJson>(); json.series.Add(new SeriesItemJson("蒸发量") { data = new List <int>() { 15, 17, 19 }, data_f = new List <double>() { 15.0, 17.0, 19.0 } }); json.series.Add(new SeriesItemJson("降水量") { data = new List <int>() { 15, 21, 36 }, data_f = new List <double>() { 15.0, 21.0, 36.0 } }); json.xAxis = new List <xAxisItemJson>(); json.xAxis.Add(new xAxisItemJson() { categories = new List <string>() { "aa", "bb", "cc" }, crosshair = true }); convertJsonToPieData(json, data); return(data); }
public async Task <IActionResult> GetListingsAverageReviewsFiltered(int neighbourhoodId) { var key = $"PropertyTypes-{neighbourhoodId}"; var cacheItem = await _cache.Get(key); if (cacheItem != null) { return(Ok(cacheItem)); } var response = Newtonsoft.Json.JsonConvert.SerializeObject( await ChartJson.CreatePropertyType(_listingsRepo.AllStats("propertyType", neighbourhoodId)) ); _cache.Set(key, response); return(Ok(response)); }
public async Task <IActionResult> GetListingsPropertiesTypes() { const string key = "PropertyTypes"; var cacheItem = await _cache.Get(key); if (cacheItem != null) { return(Ok(cacheItem)); } var response = Newtonsoft.Json.JsonConvert.SerializeObject( await ChartJson.CreatePropertyType(_listingsRepo.AllStats("propertyType")) ); _cache.Set(key, response); return(Ok(response)); }
public async Task <IActionResult> GetListingsAverageAvailability() { const string key = "AverageAvailability"; var cacheItem = await _cache.Get(key); if (cacheItem != null) { return(Ok(cacheItem)); } var response = Newtonsoft.Json.JsonConvert.SerializeObject( await ChartJson.CreateAvailability(_listingsRepo.AllStats("availability")) ); _cache.Set(key, response); return(Ok(response)); }
/// <summary> /// 广东省三种专利类型申请受理(/授权)状况图(年月) /// 数据来源:GDPAPatentChartBaseData /// </summary> /// <param name="context"></param> /// <returns></returns> private ChartJson getData_3Z_ZLLX_SQSL_ZKT(CRBIHttpContextQuery context) { ChartJson json = new ChartJson(); json.charttype = context.charttype; json.xAxis.Add(new xAxisItemJson() { categories = new List <string>() { }, crosshair = true }); json.series.Add(new SeriesItemJson("发明")); json.series.Add(new SeriesItemJson("实用新型")); json.series.Add(new SeriesItemJson("外观设计")); //GDPAPatentChartBaseDataQuery query = new GDPAPatentChartBaseDataQuery() CRBIHttpContextQuery query = new CRBIHttpContextQuery() { //n_PatentStatus = context.type, //d_StartDate = context.startDate, //d_EndDate = context.endDate }; DataTable table = new DataTable(); // GDPAPatentChartBaseDataAccessor.Instance().loadDataSZZLLXSQSLZKT(query); #region //获取发明数据 var t_fm = table.Select(String.Format("(n_PatentType ={0})", 1)); json.series[0].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); #endregion #region //获取实用新型 t_fm = table.Select(String.Format("(n_PatentType ={0} )", 2)); json.series[1].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); #endregion #region //获取外观设计 t_fm = table.Select(String.Format("(n_PatentType ={0} )", 3)); json.series[2].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); #endregion return(json); }
public CRBIDocChartData LoadContent_4_1() { CRBIDocChartData data = new CRBIDocChartData(); ChartJson json = new ChartJson(); //json.chart = true; //json.charttype = "line"; //json.xAxis.Add(new xAxisItemJson() { categories = new List<string>() { "直接访问", "邮件营销", "联盟广告", "视频广告", "搜索引擎" }, crosshair = true }); //json.series.Add(new SeriesItemJson("访问来源"));// { data = new List<int>() { 15,17,19 }, data_f = new List<double>() { 15.0,17.0,19.0 } }); ////json.series.Add(new SeriesItemJson("降水量"));// { data = new List<int>() { 15, 21, 36 }, data_f = new List<double>() { 15.0, 21.0, 36.0 } }); //json.series[0].data.Add(330); //json.series[0].data.Add(334); //json.series[0].data.Add(530); //json.series[0].data.Add(300); //json.series[0].data.Add(377); //convertJsonToPieData(json, data); data = new CRBIDocChartData("pie"); data.Columns.Add(new CRBIDocChartData.CRBIDocChartDataItem(new List <int>() { 30 }, "直接访问", 1)); data.Columns.Add(new CRBIDocChartData.CRBIDocChartDataItem(new List <int>() { 40 }, "邮件营销", 2)); data.Columns.Add(new CRBIDocChartData.CRBIDocChartDataItem(new List <int>() { 30 }, "联盟广告", 3)); data.AddHeader(new List <string>() { "直接访问" }); return(data); }
public override string Generate(string[] cols, string catalog) { if (Data == null || Data.Rows.Count == 0) { return(string.Empty); } chartStruct = new ChartStruct(); chartStruct.columns = new List <List <object> >(); List <object> objList = null; chartStruct.axis = new Common.Axis(); chartStruct.axis.x = new Common.X(); chartStruct.axis.x.type = catalog; string[] cataAry = Data.AsEnumerable().Select(d => d.Field <string>(catalog)).ToArray(); chartStruct.axis.x.categories = string.Join(",", cataAry); chartStruct.axis.y = new Common.Y(); chartStruct.axis.y.label = string.Empty; foreach (string col in cols) { objList = new List <object>(); objList.Insert(0, col); foreach (DataRow row in Data.Rows) { objList.Add(row[col].ToString()); } chartStruct.columns.Add(objList); } string json = JsonConvert.SerializeObject(new { data = chartStruct }); return(ChartJson.Replace("@Content", json)); }
private void getSeriesDataByPatentType(int patenttype, ChartJson json, DataTable table, int year, string sWhere, bool isCount = false) { DataRow[] t_fm = null; var count = 0; var zzl = 0.0; #region //获取发明数据 if (patenttype == 0 || patenttype == 1) { t_fm = table.Select(String.Format(sWhere, 1, year)); count = 0; zzl = 0.0; for (int i = 0; i < t_fm.Length; i++) { count += Int32.Parse(t_fm[i]["n_Count"].ToString()); zzl += Math.Round(Convert.ToDouble(t_fm[i]["ZZL"].ToString()), 4); } json.series[0].data.Add(count); json.series[0].data_f.Add(zzl); if (patenttype == 1) { json.series[1].data.Add(0); json.series[1].data_f.Add(0); json.series[2].data.Add(0); json.series[2].data_f.Add(0); } } #endregion #region //获取实用新型 if (patenttype == 0 || patenttype == 2) { t_fm = table.Select(String.Format(sWhere, 2, year)); count = 0; zzl = 0.0; for (int i = 0; i < t_fm.Length; i++) { count += Int32.Parse(t_fm[i]["n_Count"].ToString()); zzl += Math.Round(Convert.ToDouble(t_fm[i]["ZZL"].ToString()), 4); } json.series[1].data.Add(count); json.series[1].data_f.Add(zzl); if (patenttype == 2) { json.series[0].data.Add(0); json.series[0].data_f.Add(0); json.series[2].data.Add(0); json.series[2].data_f.Add(0); } } #endregion #region //获取外观设计 if (patenttype == 0 || patenttype == 3) { t_fm = table.Select(String.Format(sWhere, 3, year)); count = 0; zzl = 0.0; for (int i = 0; i < t_fm.Length; i++) { count += Int32.Parse(t_fm[i]["n_Count"].ToString()); zzl += Math.Round(Convert.ToDouble(t_fm[i]["ZZL"].ToString()), 4); } json.series[2].data.Add(count); json.series[2].data_f.Add(zzl); if (patenttype == 3) { json.series[0].data.Add(0); json.series[0].data_f.Add(0); json.series[1].data.Add(0); json.series[1].data_f.Add(0); } } #endregion #region //总和 if (patenttype == 0 && isCount == true) { t_fm = table.Select(String.Format(sWhere, 0, year)); count = 0; zzl = 0.0; for (int i = 0; i < t_fm.Length; i++) { count += Int32.Parse(t_fm[i]["n_Count"].ToString()); zzl += Math.Round(Convert.ToDouble(t_fm[i]["ZZL"].ToString()), 4); } json.series[3].data.Add(count); json.series[3].data_f.Add(zzl); } #endregion }
/// <summary> /// 站点级近一周整体健康状态 /// </summary> /// <param name="context"></param> /// <returns></returns> private ChartJson get_S_7D_ZTJKZT_SQJsonData(CRBIHttpContextQuery context) { ChartJson json = new ChartJson(); json.charttype = context.charttype; json.xAxis.Add(new xAxisItemJson() { categories = new List <string>() { }, crosshair = true }); if (context.querydateflag == 0) { context.startDate = DateTime.Now.AddDays(-7); } //else //{ // context.startDate = DateTime.Now.AddMonths(-1); //} context.endDate = DateTime.Now; for (int i = 0; i < 7; i++) //添加近一周日期 { json.series.Add(new SeriesItemJson(context.startDate.AddDays(i).ToString("mm-dd"))); } DataTable table = null; //查询某站点各设备运行数据 table = CRBIYYBBReport.Intance().GetBatEquipmentInfo(0, 0); //GDPAPatentChartBaseDataQuery query = new GDPAPatentChartBaseDataQuery() //{ // n_PatentStatus = context.type, // d_StartDate = context.startDate, // d_EndDate = context.endDate, // n_PatentType = context.patenttype //}; //table = (context.patenttype == 0) ? GDPAPatentChartBaseDataAccessor.Instance().loadDataWZLXSQRZLSQSLT(query) : // GDPAPatentChartBaseDataAccessor.Instance().loadDataXXXLX_ZLSQRLXZKT(query); //申请人类型:1:大专院校,2:科研机构,3:企业,4:机关团体,5:个人 StringBuilder categories = new StringBuilder("["); //#region //获取大专院校 //var t_fm = table.Select(String.Format("(n_ApplicanterType ={0})", 1)); //json.series[0].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); //#endregion //#region //获取科研机构 //t_fm = table.Select(String.Format("(n_ApplicanterType ={0} )", 2)); //json.series[1].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); //#endregion //#region //获取企业 //t_fm = table.Select(String.Format("(n_ApplicanterType ={0} )", 3)); //json.series[2].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); //#endregion //#region //获取机关团体 //t_fm = table.Select(String.Format("(n_ApplicanterType ={0} )", 4)); //json.series[3].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); //#endregion //#region //获取个人 //t_fm = table.Select(String.Format("(n_ApplicanterType ={0} )", 5)); //json.series[4].data.Add(t_fm.Length > 0 ? Int32.Parse(t_fm[0]["n_Count"].ToString()) : 0); //#endregion return(json); }