當前位置: 首頁>>代碼示例>>C#>>正文


C# Chart.GetChartBitmap方法代碼示例

本文整理匯總了C#中Chart.GetChartBitmap方法的典型用法代碼示例。如果您正苦於以下問題:C# Chart.GetChartBitmap方法的具體用法?C# Chart.GetChartBitmap怎麽用?C# Chart.GetChartBitmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Chart的用法示例。


在下文中一共展示了Chart.GetChartBitmap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DoCreateChartImage

        protected override Image DoCreateChartImage()
        {
            var chart = new Chart();
            chart.Type = ChartType.Combo;
            chart.Width = Parameters.ChartWidth;
            chart.Height = Parameters.ChartHeight;
            chart.Series.Data = Parameters.SeriaData;
            var seriesCollection = new SeriesCollection();
            var s = new Series("", SeriesType.Line);
            foreach (var pair in Parameters.SeriaData)
            {
                s.Elements.Add(new Element()
                {
                    YValue = pair.Key,
                    XValue = pair.Value
                });
            }
            seriesCollection.Add(s);
            chart.SeriesCollection.Add(seriesCollection);

            return chart.GetChartBitmap();
        }
開發者ID:perevernihata,項目名稱:DotNetChartingOverview,代碼行數:22,代碼來源:dotnetChartAdapter.cs

示例2: GetImageHtmlFromChart

        public static HtmlAgilityPack.HtmlNode GetImageHtmlFromChart(Chart chart, HtmlAgilityPack.HtmlNode node)
        {
            Bitmap bmp = chart.GetChartBitmap();

            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Gif);
            var base64Data = Convert.ToBase64String(stream.ToArray());

            HtmlNode newRCNode = node.OwnerDocument.CreateElement("img");

            newRCNode.Attributes.Add(node.OwnerDocument.CreateAttribute("src", "data:image/gif;base64," + base64Data));
            newRCNode.Attributes.Add(node.OwnerDocument.CreateAttribute("style", "width:" + bmp.Width + "px; height:" + bmp.Height + "px"));

            return newRCNode;
        }
開發者ID:mahitosh,項目名稱:HRA4,代碼行數:15,代碼來源:UIUtils.cs

示例3: InitializeBarGraph

        private static Chart InitializeBarGraph(SeriesCollection seriesCollection, string yAxisTitle)
        {
            var chart = new Chart();
            //chart.Title = "Burndown";
            chart.Type = ChartType.Combo;
            chart.TempDirectory = VirtualPathUtility.ToAbsolute("~/file/chart");
            chart.SeriesCollection.Add(seriesCollection);
            chart.YAxis.Label.Text = yAxisTitle;
            chart.YAxis.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            chart.YAxis.DefaultTick.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            chart.XAxis.DefaultTick.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            chart.LegendBox.Visible = false;
            chart.BorderStyle = System.Web.UI.WebControls.BorderStyle.None;
            chart.TitleBox.Visible = false;
            chart.Background.Color = System.Drawing.ColorTranslator.FromHtml("#333333");
            chart.DefaultSeries.Element.Color = System.Drawing.ColorTranslator.FromHtml("#1B12A6");
            chart.DefaultElement.Color = System.Drawing.ColorTranslator.FromHtml("#1B12A6");
            chart.Width = new System.Web.UI.WebControls.Unit(600, System.Web.UI.WebControls.UnitType.Pixel);
            chart.Height = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel);
            chart.Font.Name = "Helvetica";
            chart.Font.Size = new System.Web.UI.WebControls.FontUnit(24, System.Web.UI.WebControls.UnitType.Pixel);
            chart.YAxis.Label.Font = new System.Drawing.Font("Helvetica", 8);
            chart.YAxis.DefaultTick.Label.Font = new System.Drawing.Font("Helvetica", 8);
            chart.XAxis.DefaultTick.Label.Font = new System.Drawing.Font("Helvetica", 8);

            //NOTE: needed to do this for the old version of .net charting (3.4).
            chart.FileManager.TempDirectory = VirtualPathUtility.ToAbsolute("~/file/chart");
            chart.FileManager.SaveImage(chart.GetChartBitmap());

            //chart.FileManager.FileName = chart.FileManager.TempDirectory + "/" + chart.FileManager.FileName + ".png";
            return chart;
        }
開發者ID:rkurz,項目名稱:Cerebro,代碼行數:32,代碼來源:ChartService.cs


注:本文中的Chart.GetChartBitmap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。