Solved

How do I create a asp.net chart with side by side

Posted on 2011-03-21
4
298 Views
Last Modified: 2012-05-11
I have a graph that needs to be done side by side. an example would be you have two sets of dates. one date set is jan 1, 2011 - jan 7, 2011 and the second set is march 12, 2011 - march 19, 2011. what I need to know is how to have a side by side comparison from both of these date sets vertically. so the first date set would be on the left and the second date set would be on the right. my data looks like this...

date         |   hour   |   mw
1/1/2011       1        500
1/1/2011       2        500
1/1/2011       3        500
1/1/2011       4        500
1/1/2011       5        500
1/2/2011       1        500
1/2/2011       2        500
1/2/2011       3        500
1/2/2011       4        500
1/2/2011       5        500
1/3/2011       1        500
1/3/2011       2        500
1/3/2011       3        500
1/3/2011       4        500
1/3/2011       5        500

3/12/2011     1        500
3/12/2011     2        500
3/12/2011     3        500
3/12/2011     4        500
3/12/2011     5        500
3/13/2011     1        500
3/13/2011     2        500
3/13/2011     3        500
3/13/2011     4        500
3/13/2011     5        500
3/14/2011     1        500
3/14/2011     2        500
3/14/2011     3        500
3/14/2011     4        500
3/14/2011     5        500
0
Comment
Question by:bschave2
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
nbove earned 500 total points
ID: 35185292
Bind each set of data to a gridview with a style of "display:inline"
0
 

Author Comment

by:bschave2
ID: 35191287
i need this to be a chart with points. I cannot use a gridview.
0
 
LVL 7

Assisted Solution

by:nbove
nbove earned 500 total points
ID: 35191634
The method of rendering the tables is rather irrelevant.  The end result will be two table elements.  If you simply add a "style=display:inline" to those tables, they will display side by side.
0
 

Author Comment

by:bschave2
ID: 35284222
nevermind. I used a union on the data and created strip lines to solve this problem. Here is the code.
on page load i put:

CurrentChart.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = false;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.LabelStyle.Interval = 24;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.MajorGrid.Interval = 24;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.MajorTickMark.Interval = 24;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.Interval = 24;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines.Add(new StripLine());
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines[0].StripWidth = 168;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines[0].BackColor = System.Drawing.ColorTranslator.FromHtml("#eeeeee");
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines[0].IntervalOffset = 168;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines.Add(new StripLine());
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines[1].StripWidth = 168;
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines[1].BackColor = System.Drawing.ColorTranslator.FromHtml("#99ccff");
                CurrentChart.ChartAreas["ChartArea1"].AxisX.StripLines[1].IntervalOffset = 0;

                
                Build_daily_Graphs();

private void Build_daily_Graphs()
        {
            try
            {
                CurrentChart.DataSource = Get_WPP_Period(ReportType);

                CurrentChart.Series["WPPSeries"].XValueMember = "study_date";
                CurrentChart.Series["WPPSeries"].YValueMembers = "mw";

                CurrentChart.Series["MinSeries"].XValueMember = "study_date";
                CurrentChart.Series["MinSeries"].YValueMembers = "minmw";
                CurrentChart.Series["MinSeries"].Color = Color.Red;

                CurrentChart.Series["MaxSeries"].XValueMember = "study_date";
                CurrentChart.Series["MaxSeries"].YValueMembers = "maxmw";
                CurrentChart.Series["MaxSeries"].Color = Color.Red;
                
                CurrentChart.DataBind();

               
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

        }

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

808 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