<?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>Solution Log &#124; Antonio David - NVNCBL &#187; chart</title>
	<atom:link href="http://www.nvncbl.com/tagged/chart/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nvncbl.com</link>
	<description>A place to log my programming solutions for future reference</description>
	<lastBuildDate>Sun, 28 Aug 2011 01:20:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Chart Control Dynamic Data Labels</title>
		<link>http://www.nvncbl.com/2009/08/chart-control-dynamic-data-labels/</link>
		<comments>http://www.nvncbl.com/2009/08/chart-control-dynamic-data-labels/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 21:32:35 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=302</guid>
		<description><![CDATA[When using a chart control to plot data from a stored procedure (or any query for that matter), the stored procedure needs to return series&#8217; in columns.  Data to be plotted has to be in numeric form.  How, then, can we label the series?  Perhaps one would think to add a row at the top [...]]]></description>
			<content:encoded><![CDATA[<p>When using a chart control to plot data from a stored procedure (or any query for that matter), the stored procedure needs to return series&#8217; in columns.  Data to be plotted has to be in numeric form.  How, then, can we label the series?  Perhaps one would think to add a row at the top of the result set to contain the labels. But that won&#8217;t work because the column data types are numeric and the labels are most likely strings.</p>
<p><span id="more-302"></span><strong>Fix:</strong></p>
<p>Have the stored procedure return the data labels in separate columns.  For example, you have a table:</p>
<table border="0">
<tbody>
<tr>
<th>year</th>
<th>best</th>
<th>average</th>
<th>worst</th>
</tr>
<tr>
<td>2009</td>
<td>5</td>
<td>4</td>
<td>3</td>
</tr>
<tr>
<td>2008</td>
<td>7</td>
<td>5</td>
<td>3</td>
</tr>
<tr>
<td>2007</td>
<td>6</td>
<td>5</td>
<td>4</td>
</tr>
<tr>
<td>2006</td>
<td>15</td>
<td>3</td>
<td>2</td>
</tr>
<tr>
<td>2005</td>
<td>6</td>
<td>1</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>&#8230; and in the resulting graph, you want series &#8220;best&#8221; and &#8220;worst&#8221; to be labeled something different. Simply modify the result to look like:</p>
<table border="0">
<tbody>
<tr>
<th>year</th>
<th>best</th>
<th>average</th>
<th>worst</th>
<th>best_label</th>
<th>worst_label</th>
</tr>
<tr>
<td>2009</td>
<td>5</td>
<td>4</td>
<td>3</td>
<td>Region 1</td>
<td>Region 4</td>
</tr>
<tr>
<td>2008</td>
<td>7</td>
<td>5</td>
<td>3</td>
<td>Region 1</td>
<td>Region 4</td>
</tr>
<tr>
<td>2007</td>
<td>6</td>
<td>5</td>
<td>4</td>
<td>Region 1</td>
<td>Region 4</td>
</tr>
<tr>
<td>2006</td>
<td>15</td>
<td>3</td>
<td>2</td>
<td>Region 1</td>
<td>Region 4</td>
</tr>
<tr>
<td>2005</td>
<td>6</td>
<td>1</td>
<td>0</td>
<td>Region 1</td>
<td>Region 4</td>
</tr>
</tbody>
</table>
<p>&#8230; and from there, set the label to the value of the new label columns.  It admittedly isn&#8217;t the most conceptually elegant solution to the problem, but if you&#8217;re pressed for time and desperately in need of a quick fix, why not go for it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2009/08/chart-control-dynamic-data-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

