From a3dfbcd5218270f9a75e6e32807b08215270b657 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期三, 11 九月 2024 11:48:23 +0800 Subject: [PATCH] Merge branch 'feature/v2.5_极光推送' into feature/V2.6.0_google --- HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 226 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs new file mode 100644 index 0000000..e64d59a --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs @@ -0,0 +1,226 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace HDL_ON.UI +{ + public class EchartsOption_Histogram + { + /// <summary> + /// x杞存暟鎹� + /// </summary> + private string XvalueText = ""; + + /// <summary> + /// Y杞存暟鎹� + /// </summary> + private string YvalueText = ""; + /// <summary> + /// x杞存爣棰� + /// </summary> + public string xTitle = ""; + /// <summary> + /// y杞存爣棰� + /// </summary> + public string yTitle = ""; + + public EchartsOption_Histogram() + { + + } + + + /// <summary> + /// 缁勮Option鏁版嵁 + /// </summary> + /// <returns></returns> + public string InitOption() + { + //缁勮Value + var newstring = optionString.Replace("{xData}", XvalueText); + newstring = newstring.Replace("{yData}", YvalueText); + newstring = newstring.Replace("{xName}", xTitle); + newstring = newstring.Replace("{yName}", yTitle); + newstring = newstring.Replace(",,", ","); + return newstring; + } + + /// <summary> + /// 缁勮x杞存枃鏈� + /// </summary> + /// <param name="xData"></param> + public void InitXdataText(List<string> xData) + { + XvalueText = ""; + foreach (var data in xData) + { + XvalueText += "'" + data + "',"; + } + } + + /// <summary> + /// 缁勮y杞存枃鏈� + /// </summary> + /// <param name="yData"></param> + public string InitYdataText(List<EnvironmentalSensorHistor> yData) + { + YvalueText = ""; + foreach (var data in yData) + { + YvalueText += "'" + data.fieldValue + "',"; + } + + return YvalueText; + } + +#if __ANDROID__ + public string optionString = @"{ + tooltip: { + trigger: 'axis', + axisPointer: { + crossStyle: { + color: '#999' + } + } + }, + grid: { + top: '10%', + left: '15%', + right: '15%', + bottom: '10%', + }, + xAxis: { + data: [{xData}], + axisTick: { + show: false + }, + axisLine: { + show: false + }, + name:'{xName}', + nameGap:5, + nameTextStyle:{ + color:'#7C8590', + fontSize:10 + }, + axisLabel: { + color: '#7C8590', + fontSize:10 + } + }, + yAxis: { + name:'{yName}', + nameGap:12, + nameTextStyle:{ + color:'#030D1C', + fontSize:10 + }, + axisLine: { + show: false + }, + axisTick: { + show: false + }, + axisLabel: { + color: '#7C8590', + fontSize:10 + } + }, + dataZoom: [ + { + type: 'inside' + } + ], + series: [ + { + type: 'bar', + showBackground: false, + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#6AB7F9' }, + { offset: 0.5, color: '#5AA6FF' }, + { offset: 1, color: '#6B97F9' } + ]) + }, + data: [{yData}] + } + ] + }"; +#else + + public string optionString = @"{ + tooltip: { + trigger: 'axis', + axisPointer: { + crossStyle: { + color: '#999' + } + } + }, + grid: { + top: '10%', + left: '10%', + right: '10%', + bottom: '10%', + }, + xAxis: { + data: [{xData}], + axisTick: { + show: false + }, + axisLine: { + show: false + }, + name:'{xName}', + nameTextStyle:{ + color:'#7C8590', + fontSize:24 + }, + axisLabel: { + color: '#7C8590', + fontSize:20 + } + }, + yAxis: { + name:'{yName}', + nameGap:35, + nameTextStyle:{ + color:'#030D1C', + fontSize:24 + }, + axisLine: { + show: false + }, + axisTick: { + show: false + }, + axisLabel: { + color: '#7C8590', + fontSize:20 + } + }, + dataZoom: [ + { + type: 'inside' + } + ], + series: [ + { + type: 'bar', + showBackground: false, + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#6AB7F9' }, + { offset: 0.5, color: '#5AA6FF' }, + { offset: 1, color: '#6B97F9' } + ]) + }, + data: [{yData}] + } + ] + }"; +#endif + + } + +} + -- Gitblit v1.8.0