eb表单示例
如何创建动态WebChart
private void Page_Load(object sender, System.EventArgs e) { string chartName=Request.QueryString["Chart"]; if (Session[chartName]!=null) { System.IO.MemoryStream chartStream=new System.IO.MemoryStream(); chartStream=((System.IO.MemoryStream)Session[chartName]; Response.OutputStream.Write(chartStream.ToArray(),0,(int)chartStream.Length); chartStream.Close(); Session.Remove(chartName); } }
继续生成一些基本的HotSpot功能; 在我们原始WebForm的Form_Load事件中,我们可以添加类似于以下内容的代码:
private void Page_Load(object sender, System.EventArgs e) { //Let's work with the Chart object for convenience Steema.TeeChart.Chart Chart1=WebChart1.Chart; //Add in a series and fill it Chart1.Aspect.View3D=false; Steema.TeeChart.Styles.Bubble bubble1=new Steema.TeeChart.Styles.Bubble(Chart1); bubble1.FillSampleValues(); //Add a SeriesToolTip to the Chart Steema.TeeChart.Tools.SeriesHotspot seriesHotSpot1=new Steema.TeeChart.Tools.SeriesHotspot(Chart1); //Steema.TeeChart.Styles.MapAction.Mark is the default value seriesHotSpot1.MapAction=Steema.TeeChart.Styles.MapAction.Mark; }
执行此代码并将鼠标移到气泡上将显示系列标记的值,在本例中为YValues。 要向图表添加缩放功能,我们需要做的就是添加一个zoomtool和一些简单的代码来控制缩放状态:
private void Page_Load(object sender, System.EventArgs e) { //Let's work with the Chart object for convenience Steema.TeeChart.Chart Chart1=WebChart1.Chart; //Add in a series and fill it Chart1.Aspect.View3D=false; Steema.TeeChart.Styles.Bubble bubble1=new Steema.TeeChart.Styles.Bubble(Chart1); bubble1.FillSampleValues(); //Add a SeriesToolTip to the Chart Steema.TeeChart.Tools.SeriesHotspot seriesHotSpot1=new Steema.TeeChart.Tools.SeriesHotspot(Chart1); //Steema.TeeChart.Styles.MapAction.Mark is the default value seriesHotSpot1.MapAction=Steema.TeeChart.Styles.MapAction.Mark; //Add a ZoomTool to the Chart Steema.TeeChart.Tools.ZoomTool zoomTool1=new Steema.TeeChart.Tools.ZoomTool(Chart1); // *************** Code for zoom support *************** //check whether zoom request is being sent CheckZoom(WebChart1); } private void CheckZoom(WebChart wChart) { ArrayList zoomedState=(ArrayList)Session[wChart.ID+"Zoomed"]; zoomedState=((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request,zoomedState); if (zoomedState==null) Session.Remove(wChart.ID+"Zoomed"); else Session.Add(wChart.ID+"Zoomed",zoomedState); }
我们现在有一个交互式图表,可响应鼠标悬停和鼠标点击事件。SeriesHotSpot(在这种情况下与气泡系列相关联)将在鼠标移过它时显示系列标记的值。但是,通过MapAction属性,我们可以在鼠标移过它时自定义SeriesHotSpot的行为。例如,我们可能希望点击其中一个气泡将我们带到指定的URL; 通过将MapAction属性设置为URL,链接SeriesHotSpot事件并在其中指定URL,这是完全可能的:
在Page_Load事件中:
seriesHotSpot1.MapAction=Steema.TeeChart.Styles.MapAction.URL; seriesHotSpot1.GetHTMLMap +=new Steema.TeeChart.Tools.SeriesHotspotEventHandler(seriesHotSpot1_GetHTMLMap);
GetHTMLMap方法:
private void seriesHotSpot1_GetHTMLMap(Steema.TeeChart.Tools.SeriesHotspot sender, Steema.TeeChart.Tools.SeriesHotspotEventArgs e) { e.PointPolygon.Title="Go to the Steema web"; e.PointPolygon.HREF="http://www.steema.com"; e.PointPolygon.Attributes="target='_blank'"; }
有效地将MapAction属性设置为Script允许您定义您喜欢的任何行为。TeeChart为您提供了一些有用的内置脚本,可以通过HelperScripts枚举来调用。例如,要在鼠标悬停在其中一个气泡序列点上时打开图像文件,我们将添加以下代码: 在Page_Load事件中:
seriesHotSpot1.MapAction=Steema.TeeChart.Styles.MapAction.Script; seriesHotSpot1.HelperScript=Steema.TeeChart.Tools.HotspotHelperScripts.Annotation;
这里的第二行确保将相关的JavaScript添加到客户端浏览器中。GetHTMLMap方法:
private void seriesHotSpot1_GetHTMLMap(Steema.TeeChart.Tools.SeriesHotspot sender, Steema.TeeChart.Tools.SeriesHotspotEventArgs e) { e.PointPolygon.Attributes=String.Format(Steema.TeeChart.Texts.HelperScriptAnnotation, "<IMG SRC=Images/myimage.jpg>"); }
进一步自定义行为只是意味着设计自己的JavaScript例程,将它们添加到客户端浏览器,然后通过将它们及其参数添加到e.PointPolygon.Attributes来调用它们。
点击了解更多下载产品最新版
↓↓↓
tml网页源码加密
html网页源码能加密吗?能加密到何种程度?
某些时候,我们可能需要对html网页源码加密,使网页源码不那么容易被他人获得。出于这个目标,本文测试一种html加密方式。
提前透露:结论超出预期,似乎还实现了反爬虫。
首先来到网址:http://fairysoftware.com/html_jia_mi.html
由页面介绍可知,这是一种使用js和escape结合实现的html加密。
直接使用页面提供的例程,加密这一段html代码:
得到加密的html代码,如下图:
然后将加密代码粘贴到一个html文件中测试,如下图:
页面可以正常打开。查看网页源码,果然源码是加密的,如下图:
特别的惊喜之处是:
如上图所示,链接果然消失了。
即使用开发者工具查看,也无法得到链接地址,而原始未加密前的html代码中是有链接的,如下图:
那么消失了的链接,还能正常点击吗?
点击,链接可以正常打开:
虽然href链接隐藏了,但还能正常打开页面,功能完全正常。
测试结果既惊喜又意外,这样的html网页加密,效果还真是不错,值得一用。
业自动化利器-Node-RED 教程例程 200+例,直接用到项目中去。
代码地址: han-link.cn/3707.html
#工业#
*请认真填写需求信息,我们会在24小时内与您取得联系。