?
Solved

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

Posted on 2011-03-21
4
Medium Priority
?
317 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 2000 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

762 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