<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>M &#187; asp.net</title>
	<atom:link href="http://mattie.id.au/tag/asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattie.id.au</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Sun, 05 Feb 2012 07:16:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Combined graph in ASP.NET with OWC</title>
		<link>http://mattie.id.au/2009/09/14/combined-graph-in-asp-net-with-owc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=combined-graph-in-asp-net-with-owc</link>
		<comments>http://mattie.id.au/2009/09/14/combined-graph-in-asp-net-with-owc/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 03:49:33 +0000</pubDate>
		<dc:creator>mattie</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[OWC]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://mattie.id.au/?p=4</guid>
		<description><![CDATA[It took me a while to find out how to get a hang of making graphs in ASP.NET combined with OWC, especially ones that aren't standard, such as combined graphs. Here is some code of a combined graph that I recently made. ]]></description>
			<content:encoded><![CDATA[<p>It took me a while to find out how to get a hang of making graphs in ASP.NET combined with OWC. There aren&#8217;t many places on the internet that show, or have a good guide. I was having troubles with creating a combined OWC graph in ASP.NET and I finally worked it out. I thought I would share. I&#8217;ve left some of the different methods and properties in there, mostly the styling ones to give a better idea on how to style your graph to suit you. The DataTable bit is in there also. If you want to test it straight out you can replace that with an array of your choosing. :]<br />
<span id="more-7"></span><br />
[sourcecode language="csharp"]</p>
<p>  const int XAxis = 0;<br />
  const int YAxis = 1;</p>
<p>  DataTable dt = this.DataSource;</p>
<p>  ChAxis axis = null;<br />
  ChAxis axis2 = null;<br />
  ChSeries seriesValue = null;<br />
  ChSeries seriesMoreValue = null;<br />
  ChSeries seriesY2 = null;</p>
<p>  ChartSpace = this.GetBaseChartSpace();<br />
  ChChart chart = ChartSpace.Charts[0];</p>
<p>  #region Grab the data from the database and put it in a couple of arrays</p>
<p>  List&lt;object&gt; listValues = new List&lt;object&gt;();<br />
  List&lt;object&gt; listMoreValues = new List&lt;object();<br />
  List&lt;object&gt; dateList = new List&lt;object&gt;();<br />
  List&lt;object&gt; listY2Values = new List&lt;object&gt;();</p>
<p>  foreach( DataRow row in dt.Rows )<br />
  {<br />
      dateList.Add(row[&quot;Date&quot;]);<br />
      listValues.Add(row[&quot;Value1&quot;]);<br />
      listMoreValues.Add(row[&quot;Value2&quot;]);<br />
      listY2Values.Add(row[&quot;ValueY2&quot;]);</p>
<p>  }	</p>
<p>  object [] dateArray = dateList.ToArray();<br />
  object [] valueArray = listValues.ToArray();<br />
  object [] moreValueArray = listMoreValues.ToArray();<br />
  object [] y2Array = listY2Values.ToArray();	          </p>
<p>  #endregion</p>
<p>  #region Series data<br />
  seriesValue = chart.SeriesCollection.Add(0);<br />
  seriesValue.Caption = &quot;Value Array&quot;;<br />
  seriesValue.SetData( ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), dateArray);<br />
  seriesValue.SetData( ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), valueArray);<br />
  seriesValue.Interior.Color = &quot;#FF9E00&quot;;</p>
<p>  seriesMoreValue = chart.SeriesCollection.Add(1);<br />
  seriesMoreValue.Caption = &quot;More Value Array&quot;;<br />
  seriesMoreValue.SetData( ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),  moreValueArray);<br />
  seriesMoreValue.Interior.Color = &quot;#F7D708&quot;;<br />
  #endregion</p>
<p>  #region Chart settings<br />
  chart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;<br />
  chart.Interior.Color = &quot;whitesmoke&quot;;<br />
  chart.PlotArea.Interior.Color = &quot;white&quot;;<br />
  chart.Title.Caption = &quot;The chart header&quot;;<br />
  chart.HasLegend = true;<br />
  chart.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom;<br />
  #endregion</p>
<p>  #region value axis (Y Axis)<br />
  chart.Axes[YAxis].Scaling.Minimum = 0;<br />
  chart.Axes[YAxis].HasTitle = true;<br />
  chart.Axes[YAxis].Title.Caption = &quot;This is the Y-axis&quot;;<br />
  chart.Axes[YAxis].HasMajorGridlines = true;<br />
  chart.Axes[YAxis].HasMinorGridlines = true;<br />
  chart.Axes[YAxis].MajorGridlines.Line.Color = &quot;lightgrey&quot;;<br />
  chart.Axes[YAxis].MinorGridlines.Line.Color = &quot;#EEEEEE&quot;;<br />
  chart.Axes[YAxis].HasTickLabels = true;<br />
  #endregion</p>
<p>  #region date axis (X Axis)<br />
  chart.Axes[XAxis].HasMajorGridlines = true;<br />
  chart.Axes[XAxis].MajorGridlines.Line.Color = &quot;lightgrey&quot;;<br />
  chart.Axes[XAxis].HasMinorGridlines = false;<br />
  chart.Axes[XAxis].HasTitle = true;<br />
  chart.Axes[XAxis].Title.Caption = &quot;Date&quot;;<br />
  #endregion</p>
<p>  #region value axis (Y2 Axis)<br />
  seriesY2 = chart.SeriesCollection.Add(0);<br />
  seriesY2.Type = ChartChartTypeEnum.chChartTypeLine;<br />
  seriesY2.SetData( ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), y2Array );<br />
  seriesY2.Caption = &quot;This is the Y2-axis&quot;;<br />
  seriesY2.Line.Color = &quot;#CE0000&quot;;<br />
  seriesY2.Ungroup(true); </p>
<p>  axis2 = chart.Axes.Add(seriesY2.get_Scalings(ChartDimensionsEnum.chDimValues));<br />
  axis2.Scaling.Minimum = 0;<br />
  axis2.HasMajorGridlines = false;<br />
  axis2.Position = ChartAxisPositionEnum.chAxisPositionRight;<br />
  axis2.HasTitle = true;<br />
  axis2.Title.Caption = &quot;Y2 caption&quot;;<br />
  #endregion<br />
[/sourcecode]</p>
<p>Some related links:<br />
<a href="http://msdn.microsoft.com/en-us/library/aa204179%28office.11%29.aspx">MSDN: Office Web Components Constants</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mattie.id.au/2009/09/14/combined-graph-in-asp-net-with-owc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
