<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Alex Gorev's Weblog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/alexgor/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/alexgor/feed.xml</link>
    <description>Power BI</description>
    <lastBuildDate>Mon, 20 Jul 2015 14:36:43 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>New Features of Power BI</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/new-features-of-power-bi</link>
      <pubDate>Fri, 19 Dec 2014 14:49:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2014/12/19/new-features-of-power-bi/</guid>
      <description><![CDATA[Today we are previewing new features for Power BI, our self-service business intelligence solution...]]></description>
      <content:encoded><![CDATA[<p>Today we are previewing new features for Power BI, our self-service business intelligence solution designed for everyone. Power BI reduces the barriers to deploying a business intelligence environment to share and collaborate on data and analytics from anywhere.</p>
<p>You can try out what is coming next here: <a href="http://www.powerbi.com/dashboards">http://www.powerbi.com/dashboards</a></p>
<p>More information available in our blog post here: <a href="http://blogs.msdn.com/b/powerbi/archive/2014/12/18/new-power-bi-features-available-for-preview.aspx">http://blogs.msdn.com/b/powerbi/archive/2014/12/18/new-power-bi-features-available-for-preview.aspx</a></p>
<p>Alex.</p>
<p>&nbsp;&nbsp;</p>
<p>&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/60/20/4645.dashboard2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-60-20/4645.dashboard2.png" alt="" width="764" height="492" /></p>]]></content:encoded>
    </item>
    <item>
      <title>MS Chart Control: Getting Started</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/ms-chart-control-getting-started</link>
      <pubDate>Mon, 07 Dec 2009 21:26:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/12/07/ms-chart-control-getting-started/</guid>
      <description><![CDATA[Scott Mitchell&nbsp;wrote a great series of articles where he describes how to use Microsoft Chart...]]></description>
      <content:encoded><![CDATA[<P>Scott Mitchell&nbsp;wrote a great series of articles where he describes how to use Microsoft Chart control from&nbsp;simple binding to more complex scenarious. I highly recommend to read his articles for everybody starting working on the control: <A href="http://www.4guysfromrolla.com/articles/072209-1.aspx" mce_href="http://www.4guysfromrolla.com/articles/072209-1.aspx">http://www.4guysfromrolla.com/articles/072209-1.aspx</A>&nbsp;</P>
<P>&nbsp;Alex.</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Setting Microsoft Chart Series Colors</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/setting-microsoft-chart-series-colors</link>
      <pubDate>Tue, 06 Oct 2009 00:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/10/06/setting-microsoft-chart-series-colors/</guid>
      <description><![CDATA[Microsoft Chart control provides different ways to set color of the series and data...]]></description>
      <content:encoded><![CDATA[<P>Microsoft Chart control provides different ways to set color of the series and data points:</P>
<P><STRONG>Palettes</STRONG></P>
<P>Selecting one of the predefined palettes is the easiest way to change chart series colors. There are 12 built-in palettes with about 10 unique colors each.</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/SettingChartSeriesColors_7C0/ChartPalettes_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/SettingChartSeriesColors_7C0/ChartPalettes_2.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/SettingChartSeriesColors_7C0/ChartPalettes_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=ChartPalettes border=0 alt=ChartPalettes src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/SettingChartSeriesColors_7C0/ChartPalettes_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/SettingChartSeriesColors_7C0/ChartPalettes_thumb.png" width=713 height=336 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/SettingChartSeriesColors_7C0/ChartPalettes_thumb.png"></A> </P>
<P>Chart types like column and line, will assign a unique color from the palette to each of the series. If chart runs out of the palette colors then it will start reusing them again.&nbsp; </P>
<BLOCKQUOTE><PRE><FONT color=#008000>// Set chart series palette</FONT>
Chart.Palette = ChartColorPalette.Pastel;</PRE></BLOCKQUOTE>
<P>Chart type like Pie, assigns unique colors to each individual data point. You can still use <STRONG>Chart.Palette</STRONG> property or you can define different palettes for different series using <STRONG>Series.Palette</STRONG> property. Note that setting Series.Palette property will force all chart types including Column to use unique colors for each data point.</P>
<P><STRONG>Important! </STRONG>To determine the color assigned to the series or data point from the palette you can call <STRONG>chart1.ApplyPaletteColors() </STRONG>method and then check Series or DataPoint.Color property.</P>
<P><STRONG>Custom Palettes</STRONG></P>
<P>If none of the predefined palettes fits your needs, you can always create custom palette with as many colors as you need:</P>
<BLOCKQUOTE><PRE><FONT color=#008000>// Set chart custom palette</FONT>
Chart.Palette = ChartColorPalette.None; <BR>Chart.PaletteCustomColors = new Color[] { Color.Red, Color.Blue, Color.Yellow};</PRE></BLOCKQUOTE>
<P><STRONG>Empty points</STRONG></P>
<P>Not all series data points are equal… When you data bind your chart to the DBNull values the data points will be automatically marked as ‘empty’. You can also mark data points as empty by setting <STRONG>DataPoint.IsEmpty</STRONG> property. Each empty data point uses the visual attributes defined in <STRONG>Series.EmptyPointStyle</STRONG> property. </P>
<BLOCKQUOTE><PRE><FONT color=#008000>// Hide all series empty data point by making them transparent</FONT>
Chart.Series[0].EmptyPointStyle.Color = Color.Transparent; <BR></PRE></BLOCKQUOTE>
<P><STRONG>Color Property</STRONG></P>
<P>If all of the above methods does not work for you, then you can always set <STRONG>Color</STRONG> property for the series or individual data point.</P>
<BLOCKQUOTE><PRE><FONT color=#008000>// Set color for the whole series</FONT>
Chart.Series[0].Color = Color.Green;

<FONT color=#008000>// Set color of a single data point</FONT>
Chart.Series[0].Points[5].Color = Color.Red;</PRE></BLOCKQUOTE>
<P>You can always switch back to using the palette colors by setting both Series and DataPoint Color properties to Color.Empty.&nbsp;</P>
<P>Alex.</P>]]></content:encoded>
    </item>
    <item>
      <title>MS Chart Layout Helper</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/ms-chart-layout-helper</link>
      <pubDate>Sun, 26 Jul 2009 21:28:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/07/26/ms-chart-layout-helper/</guid>
      <description><![CDATA[MS Chart consists of different elements (like titles, legends, chart areas, …) which all share the...]]></description>
      <content:encoded><![CDATA[<P>MS Chart consists of different elements (like titles, legends, chart areas, …) which all share the same space in the chart. It is easy to make a ‘perfect’ layout of these elements when you know exactly how many you will have and what size they going to be. It can be challenging when the content of these elements is dynamic and their size may change significantly. Today we will discuss how we can improve different aspects of the Chart elements layout.</P>
<P><U><STRONG>Examples</STRONG></U></P>
<P>First of all, let’s start by looking at several different charts before (left) and after (right) we applied our layout improvement rules.</P>
<P><EM>Example 1: Legend position was changed from Bottom to Right and its’ width was truncated.</EM></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_1%5B1%5D_4.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_1%5B1%5D_4.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_1%5B1%5D_4.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image_thumb_1[1] border=0 alt=image_thumb_1[1] src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_1%5B1%5D_thumb_1.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_1%5B1%5D_thumb_1.png" width=640 height=161 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_1%5B1%5D_thumb_1.png"></A> </P>
<P><EM>Sample 2: Title font was reduced and legend position switched from Bottom to Right.</EM></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_2%5B1%5D_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_2%5B1%5D_2.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_2%5B1%5D_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image_thumb_2[1] border=0 alt=image_thumb_2[1] src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_2%5B1%5D_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_2%5B1%5D_thumb.png" width=640 height=171 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_2%5B1%5D_thumb.png"></A> </P>
<P><EM>Sample 3: Vertical axis labels were limited to 30% of the chart width.</EM></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb%5B1%5D_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb%5B1%5D_2.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb%5B1%5D_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image_thumb[1] border=0 alt=image_thumb[1] src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb%5B1%5D_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb%5B1%5D_thumb.png" width=640 height=203 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb%5B1%5D_thumb.png"></A> </P>
<P><EM>Sample 4: Bottom axis long labels are truncated and vertical axis labels are shown in thousands.</EM></P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_3%5B1%5D_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_3%5B1%5D_2.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_3%5B1%5D_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image_thumb_3[1] border=0 alt=image_thumb_3[1] src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_3%5B1%5D_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_3%5B1%5D_thumb.png" width=640 height=501 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_3%5B1%5D_thumb.png"></A> </P>
<P>Sample 5: Labels are shown only for the largest 7 slices in the Pie.</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_4%5B1%5D_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_4%5B1%5D_2.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_4%5B1%5D_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image_thumb_4[1] border=0 alt=image_thumb_4[1] src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_4%5B1%5D_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_4%5B1%5D_thumb.png" width=640 height=290 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DynamicChartElementsLayoutHelper_103E2/image_thumb_4%5B1%5D_thumb.png"></A> </P>
<P><STRONG><U>Legend</U></STRONG></P>
<P>The most common issue with the Legend, is that it can take significant amount of chart space and can make the actual chart data difficult to read. Here are things that can improve legend layout: </P>
<UL>
<LI>Legend is docked depending on the proportions of the chart so that it takes advantage of the available space. For example, if we have a wide chart, it is better to dock legend on the Right than on the Bottom of the chart. </LI>
<LI>Limit space available to the legend to 30% of the total chart space. Legend will be trimmed if its’ content exceeds 30% of the chart size. </LI>
<LI>Hide legend when chart becomes too small. </LI></UL>
<P><U><STRONG>Title</STRONG></U></P>
<P>If chart title content depends on the dynamic data, its’ size can grow unpredictably and interfere with the data we are trying to shown in the chart. This is very similar with the Legend issues described above.</P>
<UL>
<LI>Limit space available to the title to 20% of the total chart space. If title exceeds 20%, we will try to reduce its’ font size and then truncate the content. </LI>
<LI>Hide title when chart becomes too small. </LI></UL>
<P><U><STRONG>Axis Labels</STRONG></U></P>
<P>A single very long label can make chart very hard to read. </P>
<UL>
<LI>Limit maximum size available to the axis labels to 30% of the chart size. If labels can not fit their content will be automatically truncated. </LI>
<LI>Use multipliers for showing values in thousands, millions, billions,… Instead of showing a very long axis label like this ‘50,000,000.00’, you can display ‘50’ and add ‘(in millions)’ to the axis title. </LI></UL>
<P><U><STRONG></STRONG></U></P>
<P><U><STRONG>Pie Labels</STRONG></U></P>
<P>Pie chart type is not the best visualization if you need to display many (&gt;10) data points. It is hard to read and if you enable data point labels, there is a high chance that they will start overlapping. If you have to us the Pie chart it makes sense to show labels only for the largest slices in the pie.</P>
<UL>
<LI>Only display labels for the largest 7 slices in the Pie or Doughnut chart. </LI></UL>
<P><U><STRONG>How to use?</STRONG></U></P>
<P>All these rules are implemented and can be automatically applied using <STRONG>ChartLayoutUtilities</STRONG> add-on. Attached project contains ChartLayoutUtilities class and a sample Web Form. Just create an instance of this call passing reference to the chart control!</P>
<P>&nbsp;Alex.</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/84/95/39/ChartsWithLongLabels.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-84-95-39/ChartsWithLongLabels.zip">ChartsWithLongLabels.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Displaying Categorical Axis Labels.</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/displaying-categorical-axis-labels</link>
      <pubDate>Fri, 27 Mar 2009 13:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/03/27/displaying-categorical-axis-labels/</guid>
      <description><![CDATA[In this post I will discuss labeling of the categorical axes in SQL Reporting Services (SSRS) and...]]></description>
      <content:encoded><![CDATA[<P>In this post I will discuss labeling of the categorical axes in SQL Reporting Services (SSRS) and .NET Chart controls. Same engine is used between these two products and they have exactly the same behavior. You can find detailed steps and sample code at the end of the post.</P>
<P>Before we start, lets have a look how automatic chart axis labels work... When you data bind your chart, axis automatically calculates data scale and sets axis Minimum and Maximum values. Based on the axis scale, chart determines axis labels text, interval (how often labels are shown), font size and label rotation, so that labels do not overlap each other. Below you can see a simple chart with categorical values (countries) shown on the bottom axis:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_4.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_4.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=258 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_1.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_1.png" width=426 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_1.png"></A></P>
<P>As you can see, there is not enough space to show all the labels and chart only displays every other country. For categorical axis it is important to show as many categories as possible and here are few different tricks which will help you achieving that. </P>
<H3>Solution 1: Force chart axis to display every category.</H3>
<P>Chart axis <STRONG>Interval</STRONG> property allows you to provide your own custom interval for axis labels, grid lines and tick marks. Our first solution is to set this property to 1, which will force the chart to display every single category. As you can see on the chart below, every country will become visible and chart will automatically rotate labels to better fit them. If you are using Column chart type you can also switch to Bar chart type to avoid labels rotation.&nbsp; </P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_6.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_6.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_6.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=258 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_2.png" width=427 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_2.png"><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_18.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_18.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_18.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=257 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_8.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_8.png" width=426 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_8.png"></A></A></P>
<P>This is a very simple approach but you should also be aware of the possible down sides. In case you have too many categories, labels auto-fit algorithm may not be able to completely avoid labels overlapping and they will be very hard to read. I simulated this by reducing our original chart width in half and as you can see it is very hard to read the labels. If we double number of data points (countries) it will be even harder to read this chart. </P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_16.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_16.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_16.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=259 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_7.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_7.png" width=239 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_7.png"></A></P>
<H3>Solution 2: Enable Variable Count interval and set preferred labels appearance</H3>
<P>Second solution keeps the axis Interval in automatic mode, so that in extreme cases we can still reduce number of labels on the axis. First step is to disable labels auto fitting and specify the preferred font size and rotation. In our case we are trying to fit as much labels as possible, so we will set axis labels rotation angle to 90 degrees. And the last step is to enable Variable Interval calculation mode on the axis. By default, chart displays about 5 labels on the axis no matter how long it is, Variable Interval mode will allow you display as many labels as we can fit into the axis. After all this changes you should see something very similar to the Solution 1 chart:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_10.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_10.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_10.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=258 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_4.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_4.png" width=427 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_4.png"></A></P>
<P>Now let's try to reduce the size of the chart and see what will be different... As you can see in the image below, when chart cannot fit more vertically oriented labels it starts skipping them to avoid making chart completely unreadable.</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_14.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_14.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_14.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=258 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_6.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_6.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingCategoricalAxisLabels_7494/image_thumb_6.png"></A></P>
<H3>Conclusion</H3>
<P>When categories are displayed on the axis, there is no grantee that all of them will be shown. You can set axis interval to 1 if it is extremely important to see every category but keep in mind that labels may overlap if there are too many categories. Use Variable Interval and labels rotation if you want to fit as many labels as possible and still have labels skipping in extreme cases.</P>
<H3>SSRS Steps</H3>
<P>Steps to apply Solution 1: </P>
<BLOCKQUOTE>
<P>- Right click on the bottom axis and choose <STRONG>Axis Properties </STRONG>from the context menu</P>
<P>- Set <STRONG>Interval</STRONG> field to <STRONG>1</STRONG> in the <STRONG>Axis Options</STRONG> property page</P>
<P>- Press <STRONG>Ok</STRONG> to close property dialog</P></BLOCKQUOTE>
<P>Steps to apply Solution 2: </P>
<BLOCKQUOTE>
<P>- Make sure Properties View is enabled</P>
<P>- Click on the axis to select it and display it's properties in the Properties View</P>
<P>- Set <STRONG>VariableAutoInterval</STRONG> property to <STRONG>True</STRONG></P>
<P><STRONG>- </STRONG>Set <STRONG>LabelsAngle</STRONG> property to <STRONG>90</STRONG></P>
<P><STRONG>- </STRONG>Click <STRONG>Yes</STRONG> on the pop-up dialog to labels disable auto fitting</P></BLOCKQUOTE>
<H3>&nbsp;</H3>
<H3>.NET Chart Sample Code</H3>
<DIV style="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; FONT-SIZE: 11px; OVERFLOW: auto; BORDER-LEFT: #7f9db9 1px solid; LINE-HEIGHT: 100%! important; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: courier new; BACKGROUND-COLOR: white">
<TABLE class="" style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; MARGIN: 2px 0px; WIDTH: 99%; BORDER-BOTTOM: #eee 0px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #fff; BORDER-RIGHT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<COLGROUP>
<COL style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></COLGROUP>
<TBODY>
<TR>
<TD class=""><FONT style="FONT-SIZE: 11px"></FONT><FONT style="COLOR: green">// Solution 1: Setting axis Interval </FONT><FONT style="FONT-SIZE: 11px">&nbsp;</FONT></TD></TR>
<TR>
<TD class="" style="BACKGROUND-COLOR: #f7f7f7"></FONT><FONT style="COLOR: blue">this</FONT><FONT style="FONT-SIZE: 11px">.Chart1.ChartAreas[0].AxisX.Interval = 1;&nbsp; </FONT></TD></TR>
<TR>
<TD class="">&nbsp;</TD></TR>
<TR>
<TD class="" style="BACKGROUND-COLOR: #f7f7f7"></FONT><FONT style="COLOR: green">// Solution 2: Enable variable interval </FONT><FONT style="FONT-SIZE: 11px">&nbsp;</FONT></TD></TR>
<TR>
<TD class=""></FONT><FONT style="COLOR: blue">this</FONT><FONT style="FONT-SIZE: 11px">.Chart1.ChartAreas[0].AxisX.Interval = </FONT><FONT style="COLOR: blue">double</FONT><FONT style="FONT-SIZE: 11px">.NaN;&nbsp; </FONT></TD></TR>
<TR>
<TD class="" style="BACKGROUND-COLOR: #f7f7f7"></FONT><FONT style="COLOR: blue">this</FONT><FONT style="FONT-SIZE: 11px">.Chart1.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;&nbsp; </FONT></TD></TR>
<TR>
<TD class=""></FONT><FONT style="COLOR: blue">this</FONT><FONT style="FONT-SIZE: 11px">.Chart1.ChartAreas[0].AxisX.LabelStyle.Angle = 90; </FONT></TD></TR></TBODY></TABLE></DIV>
<P>Alex.</P>]]></content:encoded>
    </item>
    <item>
      <title>Aligning Multiple Series with Categorical Values</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/aligning-multiple-series-with-categorical-values</link>
      <pubDate>Fri, 27 Mar 2009 00:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/03/27/aligning-multiple-series-with-categorical-values/</guid>
      <description><![CDATA[Binding Categorical Data Overview
Binding chart to the data source with categorical values is...]]></description>
      <content:encoded><![CDATA[<H3>Binding Categorical Data Overview</H3>
<P>Binding chart to the data source with categorical values is pretty simple and usually requires just one line of code:</P>&nbsp;&nbsp; 
<DIV style="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; FONT-SIZE: 11px; OVERFLOW: auto; BORDER-LEFT: #7f9db9 1px solid; LINE-HEIGHT: 100%! important; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: courier new; BACKGROUND-COLOR: white">
<TABLE class="" style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; MARGIN: 2px 0px; WIDTH: 99%; BORDER-BOTTOM: #eee 0px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #fff; BORDER-RIGHT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<COLGROUP>
<COL style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></COLGROUP>
<TBODY>
<TR>
<TD class=""><FONT style="FONT-SIZE: 11px">Chart1.Series[</FONT><FONT style="COLOR: blue">"Series1"</FONT><FONT style="FONT-SIZE: 11px">].Points.DataBind(mySource, </FONT><FONT style="COLOR: blue">"ProductName"</FONT><FONT style="FONT-SIZE: 11px">, </FONT><FONT style="COLOR: blue">"Sales"</FONT><FONT style="FONT-SIZE: 11px">);&nbsp; </FONT></TD></TR></TBODY></TABLE></DIV>
<P>It is important to understand that after <STRONG>DataBind</STRONG> method creates series DataPoint objects, their <STRONG>XValue</STRONG> property will always be set to zero and category is saved in the <STRONG>AxisLabel</STRONG> property. Position of each data point along the category axis is determined using the index of the object in <STRONG>Series.Points</STRONG> collection. Below is an example of what your chart may look like:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_2.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_2.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=246 alt=clip_image002 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_thumb.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_thumb.jpg" width=490 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_thumb.jpg"></A></P>
<H3>Alignment of Multiple Series</H3><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_2.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image002_2.jpg"></A>
<P>When you bind multiple series with categorical values you may run into some un-expected results based on how you prepare your data source. For example, let's imagine that our two chart series are bound to this data:</P>
<TABLE class="" cellSpacing=0 cellPadding=2 width=400 border=1>
<TBODY>
<TR>
<TD class="" vAlign=top width=199><STRONG>Series 1</STRONG></TD>
<TD class="" vAlign=top width=199><STRONG>Series 2</STRONG></TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product A = 320</TD>
<TD class="" vAlign=top width=199>Product B = 420</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product B = 580</TD>
<TD class="" vAlign=top width=199>Product E = 830</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product C = 980</TD>
<TD class="" vAlign=top width=199>&nbsp;</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product E = 100</TD>
<TD class="" vAlign=top width=199>&nbsp;</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product F = 220</TD>
<TD class="" vAlign=top width=199>&nbsp;</TD></TR></TBODY></TABLE>
<P>As you can notice, we have less categories for the second series and their order does not match categories from the first series. If we try binding chart to this data we will end up with the chart shown below. Chart uses index of the data point to position them along the axis and we end up with orange series points in the wrong position. I added data point labels so that it would easier to see the issue.</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image004_2.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image004_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image004_2.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=246 alt=clip_image004 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image004_thumb.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image004_thumb.jpg" width=490 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image004_thumb.jpg"></A></P>
<P>In order to resolve this we can modify our data source to contain same number of categories in the same order like this:</P>
<TABLE class="" cellSpacing=0 cellPadding=2 width=400 border=1>
<TBODY>
<TR>
<TD class="" vAlign=top width=199><STRONG>Series 1</STRONG></TD>
<TD class="" vAlign=top width=199><STRONG>Series 2</STRONG></TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product A = 320</TD>
<TD class="" vAlign=top width=199>Product A = Null</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product B = 580</TD>
<TD class="" vAlign=top width=199>Product B = 420</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product C = 980</TD>
<TD class="" vAlign=top width=199>Product C = Null</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product E = 100</TD>
<TD class="" vAlign=top width=199>Product E = 830</TD></TR>
<TR>
<TD class="" vAlign=top width=199>Product F = 220</TD>
<TD class="" vAlign=top width=199>Product F = Null</TD></TR></TBODY></TABLE>
<P>Simpler approach is just to make a single call to <STRONG>Chart.AlignDataPointsByAxisLabel</STRONG> method which will automatically align the two series by inserting empty points and the end result will look like this:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image006_2.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image006_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image006_2.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=246 alt=clip_image006 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image006_thumb.jpg" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image006_thumb.jpg" width=490 border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DisplayingMultipleSerieswithCategoricalV_12CBF/clip_image006_thumb.jpg"></A></P>
<P>Hope this helps!</P>
<P>Alex.</P>]]></content:encoded>
    </item>
    <item>
      <title>Charting With ASP.NET and LINQ</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/charting-with-asp-net-and-linq</link>
      <pubDate>Fri, 06 Mar 2009 12:47:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/03/06/charting-with-asp-net-and-linq/</guid>
      <description><![CDATA[Check out the new MSDN article about how to use ASP.NET Chart control with LINQ by K. Scott Allen:...]]></description>
      <content:encoded><![CDATA[<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/ChartingWithASP.NETandLINQ_8992/image_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ChartingWithASP.NETandLINQ_8992/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ChartingWithASP.NETandLINQ_8992/image_2.png"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; MARGIN: 5px 20px 0px 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=71 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/ChartingWithASP.NETandLINQ_8992/image_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ChartingWithASP.NETandLINQ_8992/image_thumb.png" width=139 align=left border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ChartingWithASP.NETandLINQ_8992/image_thumb.png"></A> Check out the new MSDN article about how to use ASP.NET Chart control with LINQ by K. Scott Allen: <A title=http://msdn.microsoft.com/en-us/magazine/dd453008.aspx href="http://msdn.microsoft.com/en-us/magazine/dd453008.aspx" mce_href="http://msdn.microsoft.com/en-us/magazine/dd453008.aspx">http://msdn.microsoft.com/en-us/magazine/dd453008.aspx</A></P>
<P>Alex.</P>]]></content:encoded>
    </item>
    <item>
      <title>Deploying Microsoft Chart Controls</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/deploying-microsoft-chart-controls</link>
      <pubDate>Fri, 27 Feb 2009 13:45:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/02/27/deploying-microsoft-chart-controls/</guid>
      <description><![CDATA[MSChart.exe setup should be used to deploy Microsoft Chart controls but what exactly need to be done...]]></description>
      <content:encoded><![CDATA[<P><EM>MSChart.exe </EM>setup should be used to deploy Microsoft Chart controls but what exactly need to be done to create a deployment package in Visual Studio? Visual Studio provides an easy way to add the prerequisites using <EM>bootstrappers, </EM>and thanks to Phil Preen, now we have a detailed instructions on how to create and use .NET Chart Control bootstrapper. </P>
<P>You can find his article here: <A title=http://www.philpreen.co.uk/MSChart/ href="http://www.philpreen.co.uk/MSChart/" mce_href="http://www.philpreen.co.uk/MSChart/">http://www.philpreen.co.uk/MSChart/</A></P>
<P>Alex.</P>]]></content:encoded>
    </item>
    <item>
      <title>Data Binding Microsoft Chart Control</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/data-binding-microsoft-chart-control</link>
      <pubDate>Fri, 20 Feb 2009 21:42:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/02/20/data-binding-microsoft-chart-control/</guid>
      <description><![CDATA[Overview
When you add a new visualization in your application, the very first thing you do, is bind...]]></description>
      <content:encoded><![CDATA[<h3>Overview</h3>
<p>When you add a new visualization in your application, the very first thing you do, is bind it to the data. Microsoft Chart control allows many different ways of populating data in the chart and it is important to understand the differences between them and being able to choose the best approach. I put together all the possible data binding options and the scenarios when they should be used.</p>
<h3>Data Sources</h3>
<p>Before jumping into the binding methods I want to quickly list all the supportable data sources which can be used in chart binding methods. Keep in mind that not all methods accept all source types.</p>
<ul>
<li>SqlCommand</li>
<li>OleDbCommand</li>
<li>SqlDataAdapter</li>
<li>OleDbDataAdapter</li>
<li>DataView</li>
<li>DataSet</li>
<li>DataReader</li>
<li>List</li>
<li>Array</li>
<li>IList</li>
<li>IListSource</li>
<li>IEnumerable</li>
</ul>
<h3>Data Point X and Y values</h3>
<p>When you bind chart you create series and series data points. Each data point in the series should have it's Y value set and in addition to the Y value you can also bind or set other data point properties:</p>
<ul>
<li><strong>X Value</strong> - Defines location of the data point along X axis. If not specified, data point index in the series will be used. </li>
<li><strong>Additional Y Values</strong> - Chart types like Bubble or Stock require multiple Y values. You can also bind additional Y values in the regular chart types, if you want to use those values for labels or tooltips.</li>
<li><strong>Category</strong> - When you displaying categories on the X axis, they are stored in the AxisLabel property of the data point. All data binding methods will automatically detect the type of the data and you should not worry about it.</li>
<li><strong>Other Properties</strong> - Some of the binding methods allow you to set additional properties like data point labels, tooltips and others.</li>
</ul>
<h3>Binding Options Overview</h3>
<p>This table lists data binding techniques, starting from the most basic methods proceeding to more advanced. </p>
<table cellpadding="6" cellspacing="0" border="1" style="width: 493px; height: 601px;">
<tbody>
<tr>
<td width="169" valign="top">
<p><strong>Chart.DataBindTable</strong></p>
</td>
<td width="267" valign="top">
<ul>
<li>Simple binding for X and Y values.</li>
<li>Automatic series creation, based on the number of columns in the data source.</li>
</ul>
</td>
<td width="271" valign="top">
<ul>
<li>No multiple Y values per series.</li>
<li>All series have same X value, or it is not set.</li>
<li>No binding for extended chart properties like tooltips.</li>
</ul>
</td>
</tr>
<tr>
<td width="170" valign="top">
<p><strong>Chart.DataSource and Chart.DataBind</strong></p>
</td>
<td width="267" valign="top">
<ul>
<li>Can be used at design-time.</li>
<li>Supports multiple Y values.</li>
</ul>
</td>
<td width="271" valign="top">
<ul>
<li>No binding for extended chart properties like tooltips. </li>
</ul>
</td>
</tr>
<tr>
<td width="171" valign="top">
<p><strong>Points.DataBind(X)Y</strong></p>
</td>
<td width="267" valign="top">
<ul>
<li>Supports multiple data sources, including separate data source for X and Y values.</li>
<li>Supports multiple Y values.</li>
<li>Provides more flexibility than methods above</li>
</ul>
</td>
<td width="271" valign="top">
<ul>
<li>No binding for extended chart properties like tooltips. </li>
</ul>
</td>
</tr>
<tr>
<td width="172" valign="top">
<p><strong>Points.DataBind</strong></p>
</td>
<td width="267" valign="top">
<ul>
<li>Same as the above, plus:</li>
<li>Supports binding for extended chart properties like tooltips.</li>
</ul>
</td>
<td width="271" valign="top">
<ul>
<li>Does not support different data sources for X and Y values of a series. </li>
</ul>
</td>
</tr>
<tr>
<td width="173" valign="top">
<p><strong>Chart.DataBindCrossTab</strong></p>
</td>
<td width="267" valign="top">
<ul>
<li>Automatically creates series for each unique value in specified column used to group the data.</li>
</ul>
</td>
<td width="271" valign="top">
<ul>
<li>Only single level grouping is supported. </li>
</ul>
</td>
</tr>
</tbody>
</table>
<h3>Binding Options Details</h3>
<blockquote sizset="1" sizcache="3">
<h4>Chart.DataBindTable method</h4>
<p>The Chart.DataBindTable method is the simplest way to bind chart to a table with several columns. New series will be automatically created for each of the columns and you can optionally use one column for the X value for all series.</p>
<p><span style="text-decoration: underline;"><strong>Example</strong></span></p>
<p>Imagine you have a data source containing these columns: Prod A, Prod B, Prod C, Prod D, Prod E, Other and SalesName, you can easily create chart below with a single line of code:</p>
<div sizset="1" sizcache="3" style="line-height: 100% !important; background-color: white; width: 427px; font-family: courier new; height: 45px; font-size: 11px; overflow: auto; border: #7f9db9 1px solid;">
<table cellpadding="0" cellspacing="0" style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;">
<colgroup><col style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></col></colgroup>
<tbody>
<tr>
<td><span style="font-size: 11px;">Chart1.DataBindTable(myReader, </span><span>"SalesName"</span><span style="font-size: 11px;">); </span></td>
</tr>
</tbody>
</table>
</div>
<br />
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_2.png"><img height="300" width="400" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_thumb.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_thumb.png" alt="image" border="0" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" /></a> </p>
<h4>&nbsp;</h4>
<h4>Chart.DataSource property</h4>
<p>Chart <strong>DataSource</strong> property is the only way to bind chart at design-time. In addition to specifying the DataSource property you also need to create series and set their <strong>YValueMembers</strong> and optionally <strong>XValueMember</strong> properties. Multiple Y values can be bound if you specify comma separated list of members in the YValueMembers property.</p>
<p>Chart will automatically bind itself to specified data source and members just before rendering. You can force chart to bind at any moment by calling <strong>Chart.DataBind() </strong>method.</p>
<div sizset="2" sizcache="3" style="line-height: 100% !important; background-color: white; width: 450px; font-family: courier new; height: 150px; font-size: 11px; overflow: auto; border: #7f9db9 1px solid;">
<table cellpadding="0" cellspacing="0" style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;">
<colgroup><col style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></col></colgroup>
<tbody>
<tr>
<td><span style="FONT-SIZE: 11px"></span><span style="COLOR: green">// Set chart data source </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">chart1.DataSource = myCommand; </td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Set series members names for the X and Y values </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>chart1.Series[<span style="COLOR: blue">"Series 1"</span><span style="FONT-SIZE: 11px">].XValueMember = </span><span style="COLOR: blue">"Name"</span><span style="FONT-SIZE: 11px">; </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">chart1.Series[<span style="COLOR: blue">"Series 1"</span><span style="FONT-SIZE: 11px">].YValueMembers = </span><span style="COLOR: blue">"Sales"</span><span style="FONT-SIZE: 11px">; </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Data bind to the selected data source </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>chart1.DataBind(); </td>
</tr>
</tbody>
</table>
</div>
<h4>&nbsp;</h4>
<h4>DataBindCrossTab</h4>
<p>The Chart.DataBindCrossTab is different compared to all other binding methods, in that it allows for the <a>grouping</a> of unique values in a column. Each unique value in the specified grouped column results in the creation of a data series. In addition, extended data point properties other than X and Y values can be bound.</p>
<p>These other properties are bound using the <em>otherFields</em> parameter using this syntax:</p>
<pre>PointProperty=Field[{Format}] [,PointProperty= Field[{Format}]].</pre>
<p>A list of these properties are as follows: <strong>AxisLabel</strong>, <strong>Tooltip</strong>, <strong>Label</strong>,&nbsp; <strong>LegendText</strong>,&nbsp; <strong>LegendTooltip</strong> and <strong>CustomPropertyName</strong> (the name of a custom property). For more information on possible formats see the <strong>Formatting Types</strong> topic in the MSDN library.</p>
<p><span style="text-decoration: underline;"><strong>Example</strong></span></p>
<p>In the sample below we have a table that has the sales and commissions of sales people for three years. We group by the "Name" column, thereby creating one data series per sales person. The X values are bound to the "Year" column, the Y values are bound to the "Sales" column, the Label property of the resulting data points (one per record) is bound to the "Commissions" column, and the LegendText property is bound to the "Name" column.&nbsp; </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_4.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_4.png"><img height="181" width="408" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_thumb_1.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_thumb_1.png" alt="image" border="0" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" /></a> </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_6.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_6.png"><img height="300" width="400" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_thumb_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/DataBindingMSChartcontrol_10712/image_thumb_2.png" alt="image" border="0" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" /></a> </p>
<div sizset="3" sizcache="3" style="line-height: 100% !important; background-color: white; width: 460px; font-family: courier new; height: 78px; font-size: 11px; overflow: auto; border: #7f9db9 1px solid;">
<table cellpadding="0" cellspacing="0" style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;">
<colgroup><col style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></col></colgroup>
<tbody>
<tr>
<td><span style="FONT-SIZE: 11px"></span><span style="COLOR: green">// Group by "Name" column, bind X values to "Year", Y values to "Sales", </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// and Label property to "Commissions. </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>chart1.DataBindCrossTab(myReader, "Name<span style="COLOR: blue">", "</span><span style="FONT-SIZE: 11px">Year</span><span style="COLOR: blue">", "</span><span style="FONT-SIZE: 11px">Sales</span><span style="COLOR: blue">", "</span><span style="FONT-SIZE: 11px">Label=Commissions"); </span></td>
</tr>
</tbody>
</table>
</div>
<h4>&nbsp;</h4>
<h4>Points.DataBind</h4>
<p>This method allows for data point properties other than X and Y values to be bound to data columns. For example, you want to set data point label to a value in one of the data source columns. These other properties are bound using the <em>otherFields</em> parameter using this syntax:</p>
<pre>PointProperty=FieldName[{Format}][,PointProperty= FieldName[{Format}]]</pre>
<p>A list of these properties includes: <strong>AxisLabel</strong>, <strong>Tooltip</strong>, <strong>Label</strong>,&nbsp; <strong>LegendText</strong>,&nbsp; <strong>LegendTooltip</strong> and <strong>CustomPropertyName</strong> (the name of a custom property).</p>
<p>This method does not allow you to specify separate data sources for the X and Y values of a series (for this functionality use the <strong>DataBind(X)Y</strong> methods described in the section above). </p>
<p><span style="text-decoration: underline;"><strong>Example</strong></span></p>
<p>Code below demonstrates how to bind X and Y values of the series to columns "Name" and "Sales" respectively. The <strong>Label</strong> and <strong>Tooltip</strong> properties of the resulting data points are also bound to the "Commissions" and "Year" column. </p>
<div sizset="4" sizcache="3" style="line-height: 100% !important; background-color: white; width: 435px; font-family: courier new; height: 70px; font-size: 11px; overflow: auto; border: #7f9db9 1px solid;">
<table cellpadding="0" cellspacing="0" style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;">
<colgroup><col style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></col></colgroup>
<tbody>
<tr>
<td><span style="FONT-SIZE: 11px">Chart1.Series[</span><span style="COLOR: blue">"Series1"</span><span style="FONT-SIZE: 11px">].Points.DataBind( </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">myReader, <span style="COLOR: blue">"Name"</span><span style="FONT-SIZE: 11px">, <span style="COLOR: blue">"Sales"</span><span style="FONT-SIZE: 11px">, </span></span><span style="COLOR: blue">"Tooltip=Year, Label=Commissions{C2}"</span><span style="FONT-SIZE: 11px">); </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<h4>&nbsp;</h4>
<h4>Points.DataBind[X]Y</h4>
<p>The DataBindXY method allows for the binding of X and Y values of a series, while DataBindY binds Y values only. When binding X and Y values using <strong>DataBindXY</strong> the same or different data sources may be used.</p>
<p>Some data sources support multiple values (e.g. data sources that have columns of data). For example, <strong>OleDbDataReader</strong> may have access to more than one column of data. If the column to be used is not specified, then the first available column will be used. To use a column other than the first one just specify the column name in the method call.</p>
<p>Note that when specifying the column names to be bound to the Y values a comma can be embedded as part of a column name by specifying a double comma.</p>
<p><span style="text-decoration: underline;"><strong>Example</strong></span></p>
<p>Code below demonstrates how to bind series points to the array of doubles.</p>
<div sizset="5" sizcache="3" style="line-height: 100% !important; background-color: white; width: 545px; font-family: courier new; height: 108px; font-size: 11px; overflow: auto; border: #7f9db9 1px solid;">
<table cellpadding="0" cellspacing="0" style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;">
<colgroup><col style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></col></colgroup>
<tbody>
<tr>
<td><span style="FONT-SIZE: 11px"></span><span style="COLOR: green">// Initialize an array of doubles. </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: blue">double</span><span style="FONT-SIZE: 11px"> [] array = { 2.8, 4.4, 6.5, 8.3, 3.6, 5.6, 7.3, 9.2, 1.0}; </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Bind the double array to the Y axis points of the data series. </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>Chart1.Series[<span style="COLOR: blue">"Series1"</span><span style="FONT-SIZE: 11px">].Points.DataBindY(array); </span></td>
</tr>
</tbody>
</table>
</div>
</blockquote>
<blockquote sizset="6" sizcache="3">
<h4>'Manual' series population</h4>
<p>In case you need to perform some custom actions while binding and none of the above methods works, you can always 'manually' bind chart by iterating through the data source and add data points to the series as needed. This approach is also very useful when series data is calculated using some formula.</p>
<p><span style="text-decoration: underline;"><strong>Example</strong></span></p>
<div sizset="6" sizcache="3" style="line-height: 100% !important; background-color: white; width: 492px; font-family: courier new; height: 727px; font-size: 11px; overflow: auto; border: #7f9db9 1px solid;">
<table cellpadding="0" cellspacing="0" style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;">
<colgroup><col style="PADDING-LEFT: 10px; FONT-SIZE: 11px; BORDER-BOTTOM: #f7f7f7 1px solid; FONT-FAMILY: courier new; WHITE-SPACE: nowrap"></col></colgroup>
<tbody>
<tr>
<td><span style="FONT-SIZE: 11px"></span><span style="COLOR: green">// Resolve the address to the Access database </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: blue">string</span><span style="FONT-SIZE: 11px"> fileNameString = </span><span style="COLOR: blue">this</span><span style="FONT-SIZE: 11px">.MapPath(</span><span style="COLOR: blue">"."</span><span style="FONT-SIZE: 11px">); </span></td>
</tr>
<tr>
<td>fileNameString += <span style="COLOR: blue">"..\\..\\..\\data\\chartdata.mdb"</span><span style="FONT-SIZE: 11px">; </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;</td>
</tr>
<tr>
<td><span style="COLOR: green">// Initialize a connection string </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: blue">string</span><span style="FONT-SIZE: 11px"> myConnectionString = </span><span style="COLOR: blue">"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source="</span><span style="FONT-SIZE: 11px"> + fileNameString; </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Define the database query </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td><span style="COLOR: blue">string</span><span style="FONT-SIZE: 11px"> mySelectQuery=</span><span style="COLOR: blue">"SELECT * FROM SALESCOUNTS;"</span><span style="FONT-SIZE: 11px">; </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;</td>
</tr>
<tr>
<td><span style="COLOR: green">// Create a database connection object using the connection string </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">OleDbConnection myConnection = <span style="COLOR: blue">new</span><span style="FONT-SIZE: 11px"> OleDbConnection(myConnectionString); </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Create a database command on the connection using query </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>OleDbCommand myCommand = <span style="COLOR: blue">new</span><span style="FONT-SIZE: 11px"> OleDbCommand(mySelectQuery, myConnection); </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;</td>
</tr>
<tr>
<td><span style="COLOR: green">// Open the connection </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">myCommand.Connection.Open(); </td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Initializes a new instance of the OleDbDataAdapter class </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>OleDbDataAdapter myDataAdapter = <span style="COLOR: blue">new</span><span style="FONT-SIZE: 11px"> OleDbDataAdapter(); </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">myDataAdapter.SelectCommand = myCommand; </td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// Initializes a new instance of the DataSet class </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>DataSet myDataSet = <span style="COLOR: blue">new</span><span style="FONT-SIZE: 11px"> DataSet(); </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;</td>
</tr>
<tr>
<td><span style="COLOR: green">// Adds rows in the DataSet </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">myDataAdapter.Fill(myDataSet, <span style="COLOR: blue">"Query"</span><span style="FONT-SIZE: 11px">); </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: blue">foreach</span><span style="FONT-SIZE: 11px">(DataRow row </span><span style="COLOR: blue">in</span><span style="FONT-SIZE: 11px"> myDataSet.Tables[</span><span style="COLOR: blue">"Query"</span><span style="FONT-SIZE: 11px">].Rows) </span></td>
</tr>
<tr>
<td>{ </td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">&nbsp;&nbsp; // For each Row add a new series </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td><span style="COLOR: blue">&nbsp;&nbsp; string</span><span style="FONT-SIZE: 11px"> seriesName = row[</span><span style="COLOR: blue">"SalesRep"</span><span style="FONT-SIZE: 11px">].ToString(); </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;&nbsp; Chart1.Series.Add(seriesName); </td>
</tr>
<tr>
<td>&nbsp;&nbsp; Chart1.Series[seriesName].ChartType = SeriesChartType.Line; </td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;&nbsp; Chart1.Series[seriesName].BorderWidth = 2; </td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: blue">&nbsp;&nbsp; for</span><span style="FONT-SIZE: 11px">(</span><span style="COLOR: blue">int</span><span style="FONT-SIZE: 11px"> colIndex = 1; colIndex &lt; myDataSet.Tables[</span><span style="COLOR: blue">"Query"</span><span style="FONT-SIZE: 11px">].Columns.Count; colIndex++) </span></td>
</tr>
<tr>
<td>&nbsp;&nbsp; { </td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // For each column (column 1 and onward) add the value as a point </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td><span style="COLOR: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string</span><span style="FONT-SIZE: 11px"> columnName = myDataSet.Tables[</span><span style="COLOR: blue">"Query"</span><span style="FONT-SIZE: 11px">].Columns[colIndex].ColumnName; </span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int</span><span style="FONT-SIZE: 11px"> YVal = (</span><span style="COLOR: blue">int</span><span style="FONT-SIZE: 11px">) row[columnName]; </span></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Chart1.Series[seriesName].Points.AddXY(columnName, YVal); </td>
</tr>
<tr>
<td>&nbsp;&nbsp; } </td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">} </td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">DataGrid.DataSource = myDataSet; </td>
</tr>
<tr>
<td>DataGrid.DataBind(); </td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;</td>
</tr>
<tr>
<td><span style="COLOR: green">// Closes the connection to the data source. This is the preferred </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7"><span style="COLOR: green">// method of closing any open connection. </span><span style="FONT-SIZE: 11px"></span></td>
</tr>
<tr>
<td>myCommand.Connection.Close(); </td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #f7f7f7">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</blockquote>
<h3>Other useful things to know</h3>
<p>Here are couple things that you should know about when binding chart:</p>
<ul>
<li><strong>Empty Points</strong> - Understand what empty points are and how you can use them. Right now the best source of the information is Chart Sample Environment but I will blog about it later.</li>
<li><strong>AlignDataPointsByAxisLabel</strong> - If you are using a stacked chart type with categorical X axis this helper method can be very useful. Find more information in the documentation and Chart Sample Environment.</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>ASP.NET Connections 2009</title>
      <link>https://docs.microsoft.com/archive/blogs/alexgor/asp-net-connections-2009</link>
      <pubDate>Fri, 20 Feb 2009 01:49:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Gorev]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexgor/2009/02/20/asp-net-connections-2009/</guid>
      <description><![CDATA[Have a question about the ASP.NET chart control? Want to meet and discuss the future visualization...]]></description>
      <content:encoded><![CDATA[<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/ASP.NETConnections2009_140CE/image_6.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ASP.NETConnections2009_140CE/image_6.png" mce_href="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ASP.NETConnections2009_140CE/image_6.png"><IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; DISPLAY: inline; MARGIN: 0px 20px 5px 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=87 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/alexgor/WindowsLiveWriter/ASP.NETConnections2009_140CE/image_thumb_2.png" original-url="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ASP.NETConnections2009_140CE/image_thumb_2.png" width=176 align=left border=0 mce_src="http://blogs.msdn.com/blogfiles/alexgor/WindowsLiveWriter/ASP.NETConnections2009_140CE/image_thumb_2.png"></A>Have a question about the ASP.NET chart control? Want to meet and discuss the future visualization roadmap? I will be at the ASP.NET Connections March 22-25. See you there!</P>
<P><A title=http://www.devconnections.com/ href="http://www.devconnections.com/" mce_href="http://www.devconnections.com/">http://www.devconnections.com/</A></P>
<P>Alex.</P>]]></content:encoded>
    </item>
  </channel>
</rss>