当前位置: 首页>>代码示例>>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;未经允许,请勿转载。