Unable to use direct method to load data in Chart

  1. #1

    Unable to use direct method to load data in Chart


    I've been trying create a chart in code behind and then load data to it, currently I'm able to create the chart but unable to load the data using a DirectMethod

    Please help.

    <%@ Page Language="C#" AutoEventWireup="true"  %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    <!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">
        <script runat="server" type="text/C#">
        static Random rand = new Random((int)DateTime.Now.Ticks);
            public class TestData
                public string Name { get; set; }
                public int Data1 { get; set; }
                public int Data2 { get; set; }
                public int Data3 { get; set; }
            protected void Page_Load(object sender, EventArgs e)
            public IEnumerable<TestData> GetData()
                List<TestData> data = new List<TestData>();
                for (int i = 1; i <= 12; i++)
                    TestData t = new TestData();
                    t.Name = new DateTime(2013, i, 1).ToString("MMMM");
                    t.Data1 = rand.Next(100);
                    t.Data2 = rand.Next(100);
                    t.Data3 = rand.Next(100);
                return data;
            public string LoadChart()
                var builder = new Chart.Builder();
                var chart = builder.StandardTheme(StandardChartTheme.Category1)
                    .Store(new Store.Builder()
                        .Model(new Model.Builder()
                            .Fields("Name", "Data1", "Data2", "Data3").ToComponent())
                        .Proxy(new DirectProxy.Builder().API(fn => fn.Read = "App.direct.GetData"))
                        new NumericAxis.Builder()
                        .Fields(new string[] { "Data1", "Data2", "Data3" })
                        .Title("Number of hits")
                        .GridConfig(new AxisGrid.Builder()
                            .Odd(new SpriteAttributes.Builder().Opacity(1).Fill("#ddd").Stroke("#bbb").StrokeWidth(0.5).ToComponent())
                        new CategoryAxis.Builder()
                        .Title("Month of the year")
                        new LineSeries.Builder()
                            .HighlightConfig(new SpriteAttributes.Builder().Size(7).Radius(7).ToComponent())
                            .MarkerConfig(new SpriteAttributes.Builder().Type(SpriteType.Cross).Size(4).Radius(4).StrokeWidth(0).ToComponent()),
                        new LineSeries.Builder()
                            .HighlightConfig(new SpriteAttributes.Builder().Size(7).Radius(7).ToComponent())
                            .MarkerConfig(new SpriteAttributes.Builder().Type(SpriteType.Circle).Size(4).Radius(4).StrokeWidth(0).ToComponent()),
                        new LineSeries.Builder()
                            .HighlightConfig(new SpriteAttributes.Builder().Size(7).Radius(7).ToComponent())
                            .MarkerConfig(new SpriteAttributes.Builder().Type(SpriteType.Circle).Size(4).Radius(4).StrokeWidth(0).ToComponent())
                return chart.ToConfig();
        <form id="form1" runat="server">
        <ext:ResourceManager runat="server" ScriptMode="Debug"></ext:ResourceManager>
        <ext:Viewport runat="server" Layout="FitLayout">
                <ext:Panel runat="server"  Layout="FitLayout">
                <Loader  Mode="Component" runat="server" DirectMethod="App.direct.LoadChart">
    Last edited by Daniil; Nov 08, 2013 at 2:42 PM. Reason: metheod => method
  2. #2
    Hi @BATCCA,

    Please replace
    .Proxy(new DirectProxy.Builder().API(fn => fn.Read = "App.direct.GetData"))
    .Proxy(new PageProxy() { DirectFn = "App.direct.GetData" })
    A DirectProxy is a different thing.
  3. #3
    This solves my issue.


Similar Threads

  1. Replies: 2
    Last Post: May 13, 2014, 8:52 AM
  2. [CLOSED] Unable to load ssrs report
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 12, 2013, 4:56 AM
  3. [CLOSED] Unable to load ssrs report on button click in 2.2
    By legaldiscovery in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 07, 2013, 12:30 PM
  4. [CLOSED] Render a Chart on a DirectEvent
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 12, 2013, 12:12 AM
  5. Unable to get the PopUp Dynamic Chart
    By nagesh in forum 2.x Help
    Replies: 6
    Last Post: Dec 05, 2012, 5:42 AM

Tags for this Thread

Posting Permissions