Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • saif 68 posts 88 karma points
    Feb 03, 2012 @ 10:25
    saif
    0

    Pie chart and Stored procedure!

    Hi All,

    I have created a control called RealTimePieChart and droped a macro on home page and it thew an error. I am using web developer 2010 Express and Umbraco 4.7.1.

    I googled it but I had no luck please could you tell me what I should do?

    Error creating usercontrol (usercontrols/wuc_RealTimePieChart.ascx)
    Unknown server tag 'asp:Chart'.
      at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
      at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
      at System.Web.UI.TemplateParser.ParseInternal()
      at System.Web.UI.TemplateParser.Parse()
      at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
      at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
      at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
      at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
      at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
      at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
      at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
      at umbraco.macro.loadUserControl(String fileName, MacroModel model, Hashtable pageElements)

     

    kind regards

    saif

     

  • Rodion Novoselov 694 posts 859 karma points
    Feb 03, 2012 @ 10:29
    Rodion Novoselov
    0

    Hi. You just have to register your chart control with either the <%@ Register %> instruction in the beginning of your ascx file or in the web.cofig inside the "pages" section.

  • saif 68 posts 88 karma points
    Feb 03, 2012 @ 10:31
    saif
    0

    Thank you Rodion for quick reply. Actually I created a lot of other controls and I didnot register them. Is Chart control is exceptional or ...?

  • Rodion Novoselov 694 posts 859 karma points
    Feb 03, 2012 @ 10:43
    Rodion Novoselov
    0

    Any control should be registered in order to use it declaratively in your markup. It's true even for "standard" asp.net controls as well. Look into the web.config file:

     

      <controls>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
           <add tagPrefix="umbraco" namespace="umbraco.presentation.templateControls" assembly="umbraco" />  
      </controls>
    The first and the secon <add> tags register standard asp.net controls associating them with the "asp:" prefix. The same thing does the third - it registers umbraco "item" and "macro" controls. If you use a 3rd part library of controls you have to register it the same way.

     

  • saif 68 posts 88 karma points
    Feb 03, 2012 @ 11:47
    saif
    0

    Now I have created a web user control called RealTimePieCharts in umbraco userControl directory.

    Here is web.config control tag

      <controls>
            <add tagPrefix="umbraco" namespace="umbraco.presentation.templateControls" assembly="umbraco" />
            <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
              assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />       
          </controls>

    But this time it throws a different error.

    Invalid temp directory in chart handler configuration [c:\Temp\TempImageFiles\].
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.Inspect()
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.ParseParams(String parameters)
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.InitializeParameters()

    then I googled it and created a TempImage folder in my project and now it throws a new error.

    please could you tell me how to solve this one.

    here is stack trace

    Error
    Object reference not set to an instance of an object.
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.GetHandlerUrl()
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.GetUrl(String query, String fileKey, String currentGuid)
      at

    thanks in adv.

     

  • Rodion Novoselov 694 posts 859 karma points
    Feb 03, 2012 @ 11:54
    Rodion Novoselov
    0

    It seems you need to create the folder mentioned (c:\Temp\TempImageFiles\) and obviously grant your application pool write access to it.

  • saif 68 posts 88 karma points
    Feb 03, 2012 @ 12:11
    saif
    0

    I did the same and when I run web site it writes the file into that folder but still throws an error.

    Object reference not set to an instance of an object.
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.GetHandlerUrl()
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.GetUrl(String query, String fileKey, String currentGuid)
      at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.GetChartImageUrl(MemoryStream stream, String imageExt)
      at System.Web.UI.DataVisualization.Charting.Chart.Render(HtmlTextWriter writer)

  • saif 68 posts 88 karma points
    Feb 03, 2012 @ 12:47
    saif
    0

    Hi Rodion,

    here is the razor code which bind data to pie char using single query.

    @{
       
    var db =Database.Open("SmallBakery");
       
    var data = db.Query("SELECT Name, Price FROM Product");
       
    var myChart =newChart(width:600,
                            height
    :400,
                            theme
    :ChartTheme.Green)
           
    .AddTitle("Product Sales")
           
    .DataBindTable(data,"Name")
           
    .Write();
    }

     

    I wonder how to bind a stored procedure with chart in the razor.

     var dfe = mdobj.GetCurrentMember().dFES;
            theDoc = wsrobj.Get_RealTimePieChart_Pivot(dfe);
            string sql = "exec dbo.Get_RealTimePieChart_Pivot @0";
            db.Execute(sql,dfe);
            var machart = new Chart(width: 600, height: 400)
            .AddTitle("Review Completness")
    .DataBindTable(dataSource: _ _ _ _ _ _ _  xField: "Sec")
            .Write();

     

     

     

     

     

  • saif 68 posts 88 karma points
    Feb 03, 2012 @ 13:23
    saif
    0

    Rodion thank you for all your help I have done it.

            var dfe = mdobj.GetCurrentMember().dFES;
            theDoc = wsrobj.Get_RealTimePieChart_Pivot(dfe);     
            var dataView = new DataView(theDoc.DT);
            var machart = new Chart(width: 600, height: 400)
                .AddTitle("Completeness Review")
                .AddSeries("Default", chartType: "Pie",
                xValue: dataView, xField: "Sec",
                yValues: dataView, yFields: "Per")
            .Write();

    kind regards

    saif

     

     

     

     

  • NM71 10 posts 30 karma points
    Aug 31, 2012 @ 14:46
    NM71
    0

    I have created umbraco site using webmatrix and trying to test the asp:chart control from a asp.net usercontrol.  Created the macro and inserted macro to a template.

    I added the tag asp in web.config and created the tempimagefiles folder. I was not able to provide permission to this folder from windows explorer to iis_Iusrs--because it is not attached to the IIS server.

    and I am getting the following error

    No http handler was found for request type 'GET'

     

    entry in web.config files is...

            <controls>
            <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization"></add>
          </controls>
        </pages>
  • NM71 10 posts 30 karma points
    Aug 31, 2012 @ 15:18
    NM71
    0

    I needed to add the handler in system.webserver and remove the url in appsettings and works.

     

    Got the solution from this site http://stackoverflow.com/questions/2117102/mscharts-no-http-handler-was-found-for-request-type-get-error

     <appSettings><add key="ChartImageHandler" value="storage=file;timeout=20;" />
    
    <compilationtargetFramework="4.0"><assemblies><addassembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>
    <
    system.webServer>
    
    > 
    <handlers accessPolicy="Read, Write, Script, Execute">
            <add name="ChartImg" verb="*" path="ChartImg.axd"  type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"  /> 

     

  • Clark Shane 1 post 21 karma points
    Nov 01, 2013 @ 11:23
    Clark Shane
    0

    It's been really interesting to see pie chart and stored procedure together helpful in my project. free charts

Please Sign in or register to post replies

Write your reply to:

Draft