Solved

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

Posted on 2011-03-21
4
305 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
[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
  • 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

730 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