Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using the ASP.NET 4.5 Chart Control

Posted on 2013-06-06
9
Medium Priority
?
2,426 Views
Last Modified: 2013-06-13
I have read the document that describes how to use the ASP.NET 4.5 Chart Control

http://msdn.microsoft.com/en-us/library/dd489237.aspx 

The Chart control was in the tool box.  

If you cannot see the Chart control in the Toolbox, right click in the Toolbox, select Choose Items, and then select the following namespaces in the .NET Framekwork Components tab:

The following files are on my hard drive:
¿System.Web.UI.DataVisualization.Charting


¿System.Windows.Forms.DataVisualization.Charting

I added properties as follows:

         <asp:SqlDataSource ID="dscWatchListChart" runat="server"
         ConnectionString="<%$ ConnectionStrings:StockSelectSQLConnectionString %>"
         
         SelectCommand="SELECT QuoteDate, ClosePrice,
            CASE  
                    WHEN TradeVolume &lt; 200 THEN 1
                ELSE ROUND(Log10(TradeVolume/100)/Log10(2),1)
            END  
            AS TradeVolume, MovingPriceAvg,MovingVolAvg  
            FROM StockHist
              WHERE SymbolID=0 AND QuoteDate &gt;= '2009-01-02'
              AND QuoteDate &lt;= '2009-02-05'
            ORDER BY QuoteDate " 
         SelectCommandType="Text" > 
   
    </asp:SqlDataSource>
   
    <asp:chart id="ChtStock" runat="server" BackColor="#D3DFF0" Width="750px"
        Height="400px" ImageLocation="~/TempImages/ChartPic/"
        ImageType="Png" BorderDashStyle="Solid" Palette="BrightPastel"
        BackSecondaryColor="White" BackGradientStyle="TopBottom" BorderWidth="2"
        BorderColor="26, 59, 105" enableviewstate="True" viewstatecontent="All"
        DataSourceID="dscWatchListChart"  Visible= "false">
       
        <legends>
                  <asp:legend LegendStyle="Row" IsTextAutoFit="False" DockedToChartArea="Price"
                      Docking="Top" IsDockedInsideChartArea="True" Name="Default" BackColor="Transparent"
                      Font="Trebuchet MS, 8.25pt, style=Bold" Alignment="Center" MaximumAutoSize="80">
                  </asp:legend>
            </legends>
            
            <Titles>
            <asp:Title Name="Title1" BackColor="Yellow" BorderColor="Black"
                Font="Microsoft Sans Serif, 10pt, style=Bold" >
            </asp:Title>
        </Titles>
            
            <borderskin skinstyle="Emboss"></borderskin>
            
            <series>
          <asp:Series ChartArea="Price" ChartType="Point" Legend="Default" Name="Close"
                XValueMember="QuoteDate" YValueMembers="ClosePrice" Color="Blue" XValueType="Date">
            </asp:Series>
         
            <asp:Series ChartArea="Price" ChartType="Line" Legend="Default" Name="MovingAvg"
                XValueMember="QuoteDate" YValueMembers="MovingPriceAvg" Color="Black" XValueType="Date">
            </asp:Series>
           
            </series>
            
            <chartareas>
                  <asp:chartarea Name="Price" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
                      BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent"
                      BackGradientStyle="TopBottom" >
                        <position y="10" height="72" width="88" x="3"></position>
                        <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False"
                            IsStartedFromZero="False"
                            Title = "Price" TitleFont ="Trebuchet MS, 8.25pt, style=Bold">
                              <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
                              <majorgrid linecolor="64, 64, 64, 64" />
                        </axisy>
      
                        <axisx linecolor="64, 64, 64, 64" IsLabelAutoFit="True" LabelAutoFitStyle="StaggeredLabels" >
                              <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" IsEndLabelVisible="True" />
                              <majorgrid linecolor="64, 64, 64, 64" />
                        </axisx>
                  </asp:chartarea>
                  
             </chartareas>
      </asp:chart>
      

There is only one error:

Error      1      The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?)      C:\Users\Dovberman\Documents\Visual Studio 2012\Projects\StockPro\WebApplication1\BestPicks.aspx.designer.cs      220      41      StockPro

Error Line:
protected global::System.Web.UI.DataVisualization.Charting.Chart ChtStock;

What do you suggest?

System.Web.UI.DataVisualization.Charting is not being recognized. Do I need a namespace declaration?

Thanks,
0
Comment
Question by:Dovberman
[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
  • 6
  • 3
9 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 39226100
uninstall and re-install
common problem
had a bad install
0
 

Author Comment

by:Dovberman
ID: 39226628
Do I need to uninstall and re-install VS 2012?

Will my projects be deleted?

Thanks,
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 39226643
save your projects in a folder and you can return to them once you re-install :)
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:Dovberman
ID: 39226766
Thank you.
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 39226948
no problem :)
Please award points if it fixed your issue :)
0
 

Author Comment

by:Dovberman
ID: 39227032
This did not help.

I started a new project which had only one page.  The one page contained only the chart control without any additional properties specified.

If this is a common problem, please give me a reference.

Thanks,
0
 

Author Comment

by:Dovberman
ID: 39229528
Has anyone else experienced this?
0
 

Accepted Solution

by:
Dovberman earned 0 total points
ID: 39231775
Several properties have been added to VS 2012.  If you open a VS2008 solution in VS 2012, the software will attempt to upgrade the project.  There may be errors due to compatibility between the two versions.

Some of the errors will be difficult to locate.
You will sometimes need to create a new page and add small sections of code from the old 2008 page until the error information is displayed. Then add additional code sections until all errors are revealed and corrected.
0
 

Author Closing Comment

by:Dovberman
ID: 39243849
This is the only solution that works.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

705 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