Creating a Chart with MS Chart Control C#

I need to create a horizontal chart on a webpage that is live and updates automatically every minute or so. The chart needs to display four horizontal lines each representing a line in our production facility. The line needs to be green unless the line is down, in which case it needs to be another color that represents the reason the line is down. The chart will show the previous twelve hours on a continual basis. If the line is down currently, I want to have a label or something showing that it is currently down. The full twelve hours needs to be the x-axis at probably 15 minute marked intervals but calculated down to the minute, and I think the line would be the y-axis with one bar for each line. I am using SQL Server 2005 and VS2010.

I have downloaded the Microsoft Chart Control and have it installed in VS2010, using asp.net 4.0. I'm attaching a sample of what the graph needs to resemble. I will also include some raw data. It seems like the STACKEDBAR100 style is close to what I want.

Spreadsheet attached with sample data and chart. The data on the chart does NOT match the actual data, but is simply a representation of how I want to lay this out.

I have not worked with asp.net charts at all, so I'm not sure where to even start.
samplechart.xlsx
Carla RomereDirector of Information TechnologyAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
I believe that you are correct in your statement that the 100% stacked bar would be the right choice.

Comparison Chart (100% Stacked Chart)
http://msdn.microsoft.com/en-us/library/gg309515.aspx#StackedChart

<Chart Palette="None" PaletteCustomColors="149,189,66; 197,56,52; 55,118,193; 117,82,160; 49,171,204; 255,136,35; 168,203,104; 209,98,96; 97,142,206; 142,116,178; 93,186,215; 255,155,83">
      <Series>
        <Series ChartType="StackedBar100" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40">
          <SmartLabelStyle Enabled="True" />
        </Series>
      </Series>
      <ChartAreas>
        <ChartArea BorderColor="White" BorderDashStyle="Solid">
          <AxisY LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
            <MajorGrid LineColor="239, 242, 246" />
            <MajorTickMark LineColor="165, 172, 181" />
            <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
          </AxisY>
          <AxisX LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
            <MajorGrid Enabled="False" />
            <MajorTickMark Enabled="False" />
            <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
          </AxisX>
        </ChartArea>
      </ChartAreas>
      <Titles>
        <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0" />
      </Titles>
    </Chart>

Open in new window


The trick would be converting the time intervals to a bar value.  I would think that you could get the difference between "insert_date", and "end_down" in minutes.  That would give you a series of values that you could "stack" on top of each other.
0
 
Bob LearnedCommented:
I am curious about what you are working with.  With 3.5, you had to download and install the charting controls, but with 4.0, they were installed with the framework.

Here is one possible place to start:

Built-in Charting Controls (VS 2010 and .NET 4 Series)
http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx
0
 
Carla RomereDirector of Information TechnologyAuthor Commented:
I'm working with the charting controls.  I just don't know where to start to show the information I want to show. I've looked at the charting controls documentation but don't see an example of what I'm looking for.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Bob LearnedCommented:
Would it be possible to attach a picture of how you would like the chart to look?
0
 
Carla RomereDirector of Information TechnologyAuthor Commented:
It is attached to the original question.
0
 
Carla RomereDirector of Information TechnologyAuthor Commented:
I've been out of town. I will try TheLearnedOne's suggestion. Please do not close this ticket.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.