Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating Dundas Chart at runtime  - ASP.NET

Posted on 2009-05-12
4
Medium Priority
?
1,741 Views
Last Modified: 2012-06-27
I need to create a Dundas chart control from scratch at runtime.  could anyone point me to a sample or provide some simple sample code for doing so??  Thanks in Advance.

this is Dundas for ASP.NET
0
Comment
Question by:BoggyBayouBoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:VikramMullick
ID: 24366163
Attached is the link
http://www.dundas.com/Products/Chart/index.aspx
Download the evaluation version . Here you will have plenty of examples for manking dundas chart , through ASP.NET
0
 
LVL 1

Author Comment

by:BoggyBayouBoy
ID: 24366255
Thanks, but I already did that.   I don't see any purely run-time generated controls in the examples.  Are you referring to any particular example?
0
 
LVL 14

Accepted Solution

by:
GiftsonDJohn earned 2000 total points
ID: 24372519
Hi

Try this.
                Chart schart = new Chart();
                schart.Width = Unit.Pixel(400);
                schart.Height = Unit.Pixel(300);
                schart.BackColor = Color.White;
                schart.BorderLineColor = Color.FromArgb(244, 244, 244);
                schart.BorderLineStyle = ChartDashStyle.Solid;
                schart.BorderLineWidth = 1;
                
                schart.CustomizeLegend += new CustomizeLegendEventHandler(schart_CustomizeLegend);
 
                schart.Titles.Add("Title of the Chart", Docking.Top, new Font("Trebuchet MS", 12, FontStyle.Bold), Color.FromArgb(26, 59, 105));
 
                schart.ImageStorageMode = ImageStorageMode.UseHttpHandler;
                schart.Attributes.Add("PreserveAspectRation", "true");
 
                schart.ChartAreas.Add("Default");
                schart.Series.Add("Series1");
 
                SeriesChartType sctype = SeriesChartType.Doughnut;
                schart.Series["Series1"].Type = sctype; 
 
                if (sctype == SeriesChartType.Doughnut || sctype == SeriesChartType.StackedRose || sctype == SeriesChartType.Pie)
                {
                    schart.ChartAreas["Default"].Area3DStyle.Perspective = 80;
                    schart.ChartAreas["Default"].Area3DStyle.XAngle = 40;
                    schart.ChartAreas["Default"].Area3DStyle.YAngle = 90;
                }
                else if (sctype == SeriesChartType.Area || sctype == SeriesChartType.Bar || sctype == SeriesChartType.Column || sctype == SeriesChartType.Bubble || sctype == SeriesChartType.RangeColumn)
                {
                    schart.ChartAreas["Default"].Area3DStyle.Perspective = 20;
                    schart.ChartAreas["Default"].Area3DStyle.XAngle = 10;
                    schart.ChartAreas["Default"].Area3DStyle.YAngle = 20;
                }
 
                schart.ChartAreas["Default"].Area3DStyle.Enable3D = true;
                schart.ChartAreas["Default"].AxisX.LabelStyle.Interval = 1;
                schart.ChartAreas["Default"].Area3DStyle.PointDepth = 200;
                schart.ChartAreas["Default"].Area3DStyle.PointGapDepth = 0;
 
                schart.ChartAreas["Default"].BackColor = Color.White;
 
 
                //schart.Series["Series1"].CustomAttributes = "LabelStyle=Outside";
                schart.Series["Series1"].CustomAttributes = "LabelStyle=Disabled";
                schart.Series["Series1"].XValueIndexed = true;
 
                schart.Series["Series1"].PaletteCustomColors = new Color[] { Color.Red, Color.Yellow, Color.Blue, Color.Green, Color.Gray };
 
                schart.DataSource = dtAggregate.DefaultView;
                dtAggregate.DefaultView.Sort = "Sort column";
 
                schart.Series["Series1"].ValueMemberX = "ValueMemberX";
                schart.Series["Series1"].ValueMembersY = "ValueMemberY";
                schart.DataBind();
 
                if (sctype == SeriesChartType.Pie || sctype == SeriesChartType.Doughnut)
                {
                    schart.Legends["Default"].HeaderSeparator = LegendSeparatorType.Line;
                    schart.Legends["Default"].HeaderSeparatorColor = Color.Gray;
                    schart.Legends["Default"].Docking = LegendDocking.Bottom;
                    schart.Legends["Default"].Alignment = StringAlignment.Center;
                    schart.Legends["Default"].BorderStyle = ChartDashStyle.Solid;
                    schart.Legends["Default"].BorderColor = Color.Black;
                    schart.Legends["Default"].BorderWidth = 1;
                    schart.Legends["Default"].ItemColumnSeparator = LegendSeparatorType.Line;
 
                    LegendCellColumn firstColumn = new LegendCellColumn("Color", LegendCellColumnType.SeriesSymbol, string.Empty);
                    firstColumn.HeaderBackColor = Color.WhiteSmoke;
 
                    LegendCellColumn secondColumn = new LegendCellColumn("Scale", LegendCellColumnType.Text, "#LEGENDTEXT");
                    secondColumn.HeaderBackColor = Color.WhiteSmoke;
                    secondColumn.Alignment = ContentAlignment.MiddleLeft;
 
                    LegendCellColumn thirdColumn = new LegendCellColumn("Count", LegendCellColumnType.Text, "#VALY");
                    thirdColumn.HeaderBackColor = Color.WhiteSmoke;
 
                    schart.Legends["Default"].CellColumns.Add(firstColumn);
                    schart.Legends["Default"].CellColumns.Add(secondColumn);
                    schart.Legends["Default"].CellColumns.Add(thirdColumn);
                }
                else
                    schart.Legends.Clear();
 
              placeholder1.Controls.Add(schart);

Open in new window

0
 
LVL 2

Expert Comment

by:MrFantastic6
ID: 36057109
I tried this example, but my new chart doesn't appear in the placeholder.  Everything is visible.  I wonder what I'm missing?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question