Chart problem

Answered (Verified) This post has 1 verified answer and 7 replies

Not Ranked
Posts: 14
perronson21 Posted: Thu Dec 15, 2011 @ 7:09 AM

hi everyone!
 i have a basic project using MVC with web Forms in ASP.NET, the web forms use ComponentArtControls 2011 , when i add  grid control ,works fine, but when i add a basic chart, don't display in the web form. anyone can help me?

      If any of you are happy, leave your email and I send the project.

Answered (Verified) Verified Answer

Top 10 Contributor
Posts: 6,149
Answered (Verified) stephen Posted: Fri Dec 16, 2011 @ 12:00 PM
Verified by perronson21

Oh, sorry- my mistake, I over looked this when looking at your code. Do you get a msising image on the page? If so, what is the path? And then look on your machine- was the image actually created? You also might want to take a look at using the cachedimageservice- again, though, this wouldn't be supported in mvc. 

Stephen Hatcher, Developer Support Manager

All Replies

Not Ranked
Posts: 14
perronson21 Posted: Thu Dec 15, 2011 @ 8:47 AM
i tested some controls, and the Chart Control it's the only  that represents the problem.


O_O,:-(
 
Not Ranked
Posts: 14
perronson21 Posted: Thu Dec 15, 2011 @ 9:15 AM
I leave the code

1.- WEB FORM

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChartView.aspx.cs" Inherits="ChartMVC.Views.ChartView.ChartView" %>

<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>

<%@ Register Assembly="ComponentArt.Web.Visualization.Charting" Namespace="ComponentArt.Web.Visualization.Charting"
    TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Content/MCA/theme.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <cc1:Chart ID="Chart1" runat='server'>
            <Series>
                <cc1:Series Name='S0'>
                </cc1:Series>
                <cc1:Series Name='S1'>
                </cc1:Series>
            </Series>
        </cc1:Chart>
    </div>
    <ComponentArt:DataGrid ID="grdRequisitionAuthList" runat="server" Width="800" 
                     AutoTheming="True" ClientIDMode ="AutoID" >
                        <Levels>
                            <ComponentArt:GridLevel>
                                    <Columns>       
                                          <ComponentArt:GridColumn HeadingText='uno' DataField = "one"/>         
                                          <ComponentArt:GridColumn HeadingText='dos' DataField = "two" />                                                    
                                     </Columns>
                            </ComponentArt:GridLevel>
                        </Levels>
    </ComponentArt:DataGrid>
    </form>
</body>
</html>
 
2.- CODE BEHIND

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Mvc;
using ChartMVC.Models;

namespace ChartMVC.Views.ChartView
{
    public partial class ChartView : ViewPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            double[] sales = new double[8] { 64.35, 66.84, 63.79, 52.36, 52.88, 77.87, 84.2, 104 };
            double[] expenses = new double[8] { 24.35, 39.84, 60.79, 21.36, 59.88, 71.87, 65.2, 88 };
            string[] months = new string[8] { "Jan 05", "Feb 05", "Mar 05","Apr 05", "May 05", "June 05", "July 05", "Aug 05" };
            Chart1.DefineValue("S0:y", sales);
            Chart1.DefineValue("S1:y", expenses);
            Chart1.DefineValue("x", months);
            Chart1.DataBind();

            List<GridBind> woango = new List<GridBind>();
            GridBind binding = new GridBind();
            binding.one = "25";
            binding.two = "Testing new Controlls";
            GridBind binding2 = new GridBind();
            binding2.one = "26";
            binding2.two = "Testing new Controllssssssssss";
            woango.Add(binding);
            woango.Add(binding2);
            grdRequisitionAuthList.DataSource = woango;
        }
    }
}


3.- CONTROLLER

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ChartMVC.Controllers
{
    public class ChartViewController : Controller
    {
        //
        // GET: /ChartView/

        public ActionResult ChartView()
        {
            return View();
        }

    }
}

4.-MODEL

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ChartMVC.Models
{
    public class GridBind
    {
        public String one { get; set; }
        public String two { get; set; }
    }
}

5.- GLOBAL ASAX 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace ChartMVC
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "ChartView", action = "ChartView", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}
 
Top 10 Contributor
Posts: 6,149
stephen Posted: Fri Dec 16, 2011 @ 9:59 AM

I can say that the chart is not built for mvc and it's not supported in that environment- it's a webcontrol for webforms. I also can't see the chart in your code; I can see the grid, but as far as the chart goes it looks like it's in a user control.   Try setting saveimageondisk to true as a first step, but again, this is not a supported environment for the control so I can't make any promises this will work for you. 

Stephen Hatcher, Developer Support Manager
Not Ranked
Posts: 14
perronson21 Posted: Fri Dec 16, 2011 @ 10:47 AM
First of all, thanks for reply, maybe you do not see the chartcontrol code ,because i change the tagprefix to "cc1". I also made the changes that you suggested for my problem, but this dont work for my. I leave my code modified.
 <cc1:Chart ID="Chart1" runat='server' SaveImageOnDisk="True" ClientIDMode ="AutoID">
            <Series>
                <cc1:Series Name='S0'>
                </cc1:Series>
                <cc1:Series Name='S1'>
                </cc1:Series>
            </Series>
        </cc1:Chart>

i keep trying to  do   this, thanks for the time.
Top 10 Contributor
Posts: 6,149
Answered (Verified) stephen Posted: Fri Dec 16, 2011 @ 12:00 PM
Verified by perronson21

Oh, sorry- my mistake, I over looked this when looking at your code. Do you get a msising image on the page? If so, what is the path? And then look on your machine- was the image actually created? You also might want to take a look at using the cachedimageservice- again, though, this wouldn't be supported in mvc. 

Stephen Hatcher, Developer Support Manager
Not Ranked
Posts: 14
perronson21 Posted: Mon Dec 19, 2011 @ 6:12 AM
thanks my friend, i add this  code to mi Web.Config

<httpHandlers>
      <add verb="GET" path="cachedimageservice.axd"
        type="ComponentArt.Web.Visualization.Charting.CachedImageService,ComponentArt.Web.Visualization.Charting" />
    </httpHandlers>



and SaveImageOnDisk="False"
<cc1:Chart ID="Chart1" runat='server' SaveImageOnDisk="False" ClientIDMode ="AutoID">
            <Series>
                <cc1:Series Name='S0'>
                </cc1:Series>
                <cc1:Series Name='S1'>
                </cc1:Series>
            </Series>
        </cc1:Chart>




this works fine for my,thanks again for your time.
 
see you soon
Top 10 Contributor
Posts: 6,149
stephen Posted: Mon Dec 19, 2011 @ 7:12 AM

Great- glad to hear it's working for you. 

Stephen Hatcher, Developer Support Manager
Page 1 of 1 (8 items)