{"id":1211,"date":"2010-07-21T13:32:00","date_gmt":"2010-07-21T05:32:00","guid":{"rendered":""},"modified":"2013-11-19T21:14:33","modified_gmt":"2013-11-19T13:14:33","slug":"teechart-for-net-%e4%bd%bf%e7%94%a8%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/1211.html","title":{"rendered":"TeeChart For .NET \u4f7f\u7528\u603b\u7ed3"},"content":{"rendered":"<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nWebChart1.AutoPostback = false;\/\/\u81ea\u52a8\u56de\u53d1\uff08\u9ed8\u8ba4\uff09\r\nWebChart1.GetChartFile = &quot;GetChart.aspx&quot;;\/\/\u5904\u7406\u6570\u636e\u9875\uff08\u9ed8\u8ba4\uff09\uff0cGetChart.aspx\u5185\u5bb9\u540e\u9644\r\nWebChart1.Width = 400;\/\/\u663e\u793a\u5bbd\u5ea6\r\nWebChart1.Height = 300;\/\/\u663e\u793a\u9ad8\u5ea6\r\nWebChart1.PictureFormat = Steema.TeeChart.Export.PictureFormats.Bitmap;\/\/\u663e\u793a\u56fe\u7247\u7684\u683c\u5f0f\uff0c\u9ed8\u8ba4PNGWebChart1.TempChart =Steema.TeeChart.Web.TempChartStyle.Session;\/\/\u8bbe\u7f6e\u4fdd\u5b58\u6570\u636e\u5f62\u5f0f\uff0c\u9ed8\u8ba4File\uff0c\u4e00\u822c\u9009session\u3002Chart.Aspect(\u5916\u89c2\u5c5e\u6027)WebChart1.Chart.Aspect.View3D = false;\/\/\u53d6\u6d883D\u8868\u793a\/\/Chart.Header(\u663e\u793a\u5934)WebChart1.Chart.Header.Visible = false;\/\/\u662f\u5426\u663e\u793a\u5934\u6587\u5b57WebChart1.Chart.Header.Text = &quot;\u9876\u90e8\u663e\u793a\u6587\u5b57&quot;;\/\/Chart.Axes(\u5750\u6807\u8f74)WebChart1.Chart.Axes.Left.Title.Text = &quot;\u7eb5\u5750\u6807\u6587\u5b57\u663e\u793a&quot;;\r\nWebChart1.Chart.Axes.Bottom.Title.Text = &quot;\u6a2a\u5750\u6807\u6587\u5b57\u663e\u793a&quot;;\/\/Chart.Legend(\u56fe\u4f8b)WebChart1.Chart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Auto;\/\/\u56fe\u4f8b\u663e\u793a\u7684\u6837\u5f0f\uff0c\u5305\u542b\u4e00\u4e0b\u65b9\u9762\uff1a\u9ed8\u8ba4autoWebChart1.Chart.Legend.Alignment=Steema.TeeChart.LegendAlignments.Bottom;\/\/WebChart1.Chart.Gradient(\u80cc\u666f\u989c\u8272)WebChart1.Chart.Gradient.Visible := true;\r\nWebChart1.Chart.Gradient.StartColor := 16744448;\/\/\u80cc\u666f\u56fe\u6848\u662f\u6e10\u53d8\u7684\u989c\u8272WebChart1.Chart.Gradient.EndColor := 8453888;\r\nWebChart1.Chart.Chart3DPercent := 1;\r\nWebChart1.Chart.View3D := False;\r\nWebChart1.Chart.View3DWalls := False;\r\nWebChart1.Chart. Legend.Alignment:=laBottom;\/\/\u5728\u5e95\u90e8\u663e\u793a\u56fe\u4f8b\r\n\/\/\u56fe\u4f8b\u663e\u793a\u4f4d\u7f6e\uff08\u663e\u793a\u7ebf\u6761\u989c\u8272\uff0c\u7ebf\u6761\u4ee3\u8868\u5bf9\u8c61\uff09WebChart1.Chart.Legend.Visible = false;\/\/\u662f\u5426\u663e\u793a\u56fe\u4f8bWebChart1.Chart.Legend.Font.Color = System.Drawing.Color.Black;\/\/\u56fe\u4f8b\u6587\u672c\u663e\u793a\u989c\u8272\/\/Chart.Panel(\u5e95\u677f\u8bbe\u7f6e)WebChart1.Chart.Panel.Color = System.Drawing.Color.AliceBlue;\/\/\u5e95\u677f\u989c\u8272\uff08\u4f3c\u4e4e\u4e0d\u7ba1\u7528\uff09\/\/chart.marks(\u8bbe\u7f6e\u6807\u793a)Chart1.Series(0).Marks.Visible = true\r\nChart1.Series(0).Marks.Style = 0\/\/\u5b9e\u4f8b\u5316\u5e8f\u5217\uff1aSteema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line();\r\nWebChart1.Chart.Series.Add(line);\/\/\u5b9e\u4f8b\u5316\u7ebf\uff0c\u4e5f\u53ef\u4ee5\u5982\u4e0b\u4e00\u53e5\u5b8c\u6210\uff1aSteema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(WebChart1.Chart);\r\nline1.YValues.DataMember = DS.Tables&#x5B;0].Columns&#x5B;2].ToString();\/\/\u8bbe\u7f6e\u6bd4\u8f83\u523b\u5ea6\uff08\u7eb5\u5750\u6807\uff09line1.LabelMember = DS.Tables&#x5B;0].Columns&#x5B;1].ToString();\/\/\u8bbe\u7f6e\u6210\u5458\u6807\u7b7e\uff08\u6a2a\u5750\u6807\uff09line.Title = &quot;111111&quot;;\/\/\u8bbe\u7f6e\u5176\u6807\u9898\uff0c\u53ef\u4ee5\u5728\u56fe\u4f8b\u4e0a\u663e\u793a\u6b64\u6807\u9898\uff0c\u591a\u7ebf\u65f6\u6709\u7528line.Color = System.Drawing.Color.Red;\/\/\u8bbe\u7f6e\u7ebf\u6761\u989c\u8272\uff0c\u53ef\u4e0d\u8bbe\u7f6e\uff0c\u9ed8\u8ba4line1.DataSource = DS.Tables&#x5B;0];\r\nWebChart1.DataBind();\/\/\u6570\u636e\u7ed1\u5b9a\r\n<\/pre>\n<p>\u80cc\u666f\u7f51\u683c\u8bbe\u7f6e\uff1a<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nch1.Axes.Left.Grid.Visible = false;\r\nch1.Axes.Bottom.Grid.Visible = false;\r\n<\/pre>\n<p><img decoding=\"async\" class=\"blogimg\" src=\".\/wp-content\/uploads\/hibaidu\/1325992a9693d6bae7cd4077.jpg\" alt=\"\" border=\"0\" \/><\/p>\n<p>Default.aspx.cs<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nusing System;\r\nusing System.Configuration;\r\nusing System.Data;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Web.UI.WebControls.WebParts;\r\nusing System.Xml.Linq;\r\nusing System.Drawing;\r\n\r\npublic partial class _Default : System.Web.UI.Page\r\n{\r\n    Steema.TeeChart.Chart chart1;\r\n    Steema.TeeChart.Styles.Vector3D vector3D1;\r\n    Steema.TeeChart.Styles.Points3D points3D1;\r\n\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        chart1 = new Steema.TeeChart.Chart();\r\n        chart1 = WebChart1.Chart;\r\n        chart1.Legend.Visible = false;\r\n        chart1.Walls.Visible = false;\r\n        chart1.Header.Lines = new string&#x5B;] { &quot;\u6ed1\u5761\u5f62\u53d8\u76d1\u6d4b&quot; };\r\n        chart1.Header.Font.Color = ColorTranslator.FromHtml(&quot;#0066cc&quot;);\/\/Chart\u7684\u6807\u9898\u989c\u8272        chart1.Series.RemoveAllSeries();\r\n        chart1.Series.Add(new Steema.TeeChart.Styles.Points3D());\r\n        chart1.Series.Add(new Steema.TeeChart.Styles.Vector3D());\r\n\r\n        points3D1 = new Steema.TeeChart.Styles.Points3D();\r\n        points3D1 = (chart1.Series&#x5B;0] as Steema.TeeChart.Styles.Points3D);\r\n\r\n        points3D1.BaseLine.Visible = false;\/\/\u53bb\u6389\u57fa\u7ebf        points3D1.LinePen.Visible = false;\r\n        points3D1.ColorEach = false;\r\n        points3D1.Pointer.HorizSize = 3;\r\n        points3D1.Pointer.VertSize = 3;\/\/\u70b9\u7684\u5927\u5c0f        points3D1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle;\r\n        points3D1.Color = ColorTranslator.FromHtml(&quot;#3399ff&quot;);\r\n        Color colora = ColorTranslator.FromHtml(&quot;#3399ff&quot;);\r\n        points3D1.Add(3433384.855, 501209.4355, 245.7408, Color.Red);\r\n        points3D1.Add(3433449.979, 501169.672, 277.4009, colora);\r\n        points3D1.Add(3433532.554, 501204.8505, 274.8762, colora);\r\n        points3D1.Add(3433580.200, 501273.3242, 267.8104, colora);\r\n        points3D1.Add(3433591.802, 501356.0894, 238.1800, colora);\r\n        points3D1.Add(3433504.041, 501284.8135, 238.8426, colora);\r\n        points3D1.Add(3433417.632, 501256.7739, 222.6148, colora);\r\n        points3D1.Add(3433281.344, 501247.8996, 178.9416, colora);\r\n        points3D1.Add(3433400.361, 501332.4863, 187.9881, colora);\r\n        points3D1.Add(3433530.563, 501439.0403, 177.6905, colora);\r\n\r\n        vector3D1 = new Steema.TeeChart.Styles.Vector3D();\r\n        vector3D1 = (chart1.Series&#x5B;1] as Steema.TeeChart.Styles.Vector3D);\r\n\r\n        vector3D1.StartColor = ColorTranslator.FromHtml(&quot;#56cc00&quot;);\r\n        vector3D1.MidColor = vector3D1.StartColor;\r\n        vector3D1.EndColor = vector3D1.StartColor;\/\/\u4f7f\u6240\u6709\u989c\u8272\u90fd\u76f8\u540c        for (int i = 1; i &lt; points3D1.Count; i++)\r\n        {\r\n            vector3D1.Add(points3D1.XValues&#x5B;i], points3D1.YValues&#x5B;i], points3D1.ZValues&#x5B;i], points3D1.XValues&#x5B;i] + 15, points3D1.YValues&#x5B;i] + 15, points3D1.ZValues&#x5B;i] + 15);\r\n        }\r\n        for (int i = 1; i &lt; points3D1.Count; i++)\r\n        {\r\n            vector3D1.Add(points3D1.XValues&#x5B;i] + 15, points3D1.YValues&#x5B;i] + 15, points3D1.ZValues&#x5B;i] + 15, points3D1.XValues&#x5B;i] + 25, points3D1.YValues&#x5B;i] + 23, points3D1.ZValues&#x5B;i] + 2);\r\n        }\r\n        Steema.TeeChart.Themes.ColorPalettes.ApplyPalette(chart1.Chart, 13);\r\n    }\r\n    protected void WebChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)\r\n    {\r\n        g.Font.Color = ColorTranslator.FromHtml(&quot;#006666&quot;);\/\/\u8bbe\u7f6e\u6587\u5b57\u7684\u989c\u8272        for (int i = 0; i &lt; points3D1.Count; i++)\r\n        {\r\n            g.TextOut(points3D1.CalcXPos(i), points3D1.CalcYPos(i), points3D1.CalcZPos(i), &quot;WS&quot; + (72 + i).ToString());\r\n        }\r\n        g.Pen.Color = ColorTranslator.FromHtml(&quot;#ff33cc&quot;);\r\n        for (int i = 1; i &lt; points3D1.Count; i++)\r\n        {\r\n            g.Line(points3D1.CalcXPos(0), points3D1.CalcYPos(0), points3D1.CalcZPos(0), points3D1.CalcXPos(i), points3D1.CalcYPos(i), points3D1.CalcZPos(i));\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>\u6548\u679c\u5982\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" class=\"blogimg\" src=\".\/wp-content\/uploads\/hibaidu\/6934bddf941b3218cdbf1a7c.jpg\" alt=\"\" border=\"0\" \/><\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n            chartController1.Chart = tChart1;\r\n            chartController1.Items&#x5B;11].Visible = false;\/\/\u4fdd\u5b58\u6309\u94ae            chartController1.Items&#x5B;8].Visible = false;\/\/\u7f16\u8f91\u6309\u94ae            chartController1.Items&#x5B;9].Visible = false;\/\/\u6253\u5370\u6309\u94ae            chartController1.Items&#x5B;7].Visible = false;\/\/\u5206\u9694\u7b26            chartController1.Items&#x5B;1].Visible = false;\/\/\u5206\u9694\u7b26            chartController1.Items&#x5B;5].Visible = false;\/\/Depth            chartController1.Items&#x5B;10].Click += SaveItemClick;\/\/\u6dfb\u52a0\u6309\u94ae\u5355\u51fb\u4e8b\u4ef6\uff0c\u5904\u7406\u51fd\u6570\u89c1\u4e0b\u9762            chartController1.Items&#x5B;10].ToolTipText = &quot;\u4fdd\u5b58&quot;;\r\n            chartController1.Items&#x5B;0].ToolTipText = &quot;\u666e\u901a&quot;;\r\n            chartController1.Items&#x5B;2].ToolTipText = &quot;\u65cb\u8f6c&quot;;\r\n            chartController1.Items&#x5B;3].ToolTipText = &quot;\u5e73\u79fb&quot;;\r\n            chartController1.Items&#x5B;4].ToolTipText = &quot;\u7f29\u653e&quot;;\r\n            chartController1.Items&#x5B;6].ToolTipText = &quot;\u4e09\u7ef4&quot;;\r\n\r\n        private void SaveItemClick(object sender, System.EventArgs e)\r\n        {\r\n           saveFileDialog1.Filter = &quot;Images (*.bmp)|*.bmp|Images(*.jpg)|*.jpg|Images(*.wmf)|*.wmf|Images(*.emf)|*.emf|Images (*.gif)|*.gif|Images (*.png)|*.png|Images (*.tiff)|*.tiff&quot;;\r\n            saveFileDialog1.ShowDialog();\r\n            if(saveFileDialog1.FileName != &quot;&quot;)\r\n                switch (saveFileDialog1.FilterIndex)\r\n                {\r\n                    case 1:\r\n                        tChart1.Export.Image.Bitmap.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                    case 2:\r\n                        tChart1.Export.Image.JPEG.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                    case 3:\/\/tChart1.Export.Image.Metafile.Enhanced = false;                        tChart1.Export.Image.Metafile.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                    case 4:\/\/tChart1.Export.Image.Metafile.Enhanced = true;                        tChart1.Export.Image.Metafile.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                    case 5:\r\n                        tChart1.Export.Image.GIF.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                    case 6:\r\n                        tChart1.Export.Image.PNG.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                    case 7:\r\n                        tChart1.Export.Image.TIFF.Save(saveFileDialog1.FileName);\r\n                        break;\r\n                }\r\n        }\r\n\r\n<\/pre>\n<p>\u6548\u679c\u5982\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" class=\"blogimg\" src=\".\/wp-content\/uploads\/hibaidu\/fb2b6323d7b7c5e44723e819.jpg\" alt=\"\" border=\"0\" \/><\/p>\n<p>\u6280\u5de7\uff1a\u5728\u8bbe\u8ba1\u89c6\u56fe\u4e0b\u9762\u8bbe\u8ba1\u60f3\u8981\u7684\u6548\u679c\uff0c\u7136\u540e\u5728\u4ee3\u7801\u91cc\u9762\u67e5\u770b\u76f8\u5e94\u7684\u66f4\u6539\u7684\u4ee3\u7801\uff0c\u5728C#\u5c31\u662f\u5728XX.Designer.cs\u3002WEB\u7248\u7684\u65f6\u5019\uff0c\u8fd8\u662f\u7528Session\u7684\u65b9\u5f0f\u6bd4\u8f83\u597d\uff0c\u8be6\u60c5\u770b\u8bf4\u660e\u6587\u6863\u3002\u6ce8\u610f\u8bbe\u7f6eAutoPostBack\u4e3aFalse\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u811a\u672c\u9519\u8bef\u3002VS2010\u7684\u65f6\u5019\uff0c\u8bbe\u7f6e\u76ee\u6807\u6846\u67b6\uff0c\u4e0d\u8981\u8bbe\u4e3aClient Profile\u7c7b\u578b\u7684\uff0c\u4e0d\u7136\u4f1a\u6709\u5f15\u7528\u9519\u8bef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebChart1.AutoPostback = false;\/\/\u81ea\u52a8\u56de\u53d1\uff08\u9ed8\u8ba4\uff09 WebChart1.Get [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1211","post","type-post","status-publish","format-standard","hentry","category-my_notes"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=1211"}],"version-history":[{"count":3,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1211\/revisions"}],"predecessor-version":[{"id":4828,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1211\/revisions\/4828"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=1211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=1211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=1211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}