[CLOSED] Very new problem on chart error : Unable to create an object of type 'System.String []' from its string representation

  1. #1

    [CLOSED] Very new problem on chart error : Unable to create an object of type 'System.String []' from its string representation

    PROBLEM SOLVED, PLEASE CLOSE AND FORGET. I SIMPLY REMOVE AND ADD SEVERAL TIMES EXT LIBRARIES FROM THE SOLUTION AND I MANAGE TO MAKE IT WORKING...ANOTHER KIND OF MAGIC I GUESS.

    Hello, I'm no more able to run an application that worked very well before. Now I have a proble on chart creation.

    I tried with an exemple from your website and I have the same problem. I think the problem is related to the recent installation of Vsiual Studio 2017 but I'm not able to undesrtand why. Could you help me please?

    The error is :
    Unable to create an object of type 'System.String []' from its string representation, 'Data1,Data2,Data3', for property 'fields'.
    Here the code I use to test :

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
        protected void ReloadData(object sender, DirectEventArgs e)
        {
            this.Chart1.GetStore().DataBind();
        }
    </script>    
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Line Chart - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            var saveChart = function (btn) {
                Ext.MessageBox.confirm('Confirm Download', 'Would you like to download the chart as an image?', function (choice) {
                    if(choice == 'yes'){
                        btn.up('panel').down('chart').save({
                            type: 'image/png'
                        });
                    }
                });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <h1>Line Chart Example</h1>
    
    	    <p>Display 2 sets of random data in a line series. Reload data will randomly generate a new set of data in the store. Click on the legend items to remove them from the chart.</p>
    
            <ext:Panel 
                runat="server"
                Title="Line Chart"
                Width="800"
                Height="600"
                Layout="FitLayout">
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button 
                                runat="server" 
                                Text="Reload Data" 
                                Icon="ArrowRefresh" 
                                OnDirectClick="ReloadData" 
                                />
    
                            <ext:Button 
                                runat="server" 
                                Text="Save Chart" 
                                Icon="Disk"
                                Handler="saveChart"
                                />
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:Chart 
                        ID="Chart1" 
                        runat="server"
                        StyleSpec="background:#fff;"                   
                        Shadow="true"
                        StandardTheme="Category1"
                        Animate="true">
                        <LegendConfig Position="Right" />
                        <Store>
                            <ext:Store 
                                runat="server" 
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="Name" />
                                            <ext:ModelField Name="Data1" />
                                            <ext:ModelField Name="Data2" />
                                            <ext:ModelField Name="Data3" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Axes>
                            <ext:NumericAxis                             
                                Fields="Data1,Data2,Data3"
                                Title="Number of Hits"
                                MinorTickSteps="1"
                                Minimum="0">
                                <GridConfig>
                                    <Odd Opacity="1" Fill="#ddd" Stroke="#bbb" StrokeWidth="0.5" />
                                </GridConfig>
                            </ext:NumericAxis>                            
    
                            <ext:CategoryAxis 
                                Position="Bottom"
                                Fields="Name"
                                Title="Month of the Year"
                                />                            
                        </Axes>
                        <Series>
                            <ext:LineSeries Axis="Left" XField="Name" YField="Data1">
                                <HighlightConfig Size="7" Radius="7" />
                                <MarkerConfig Type="Cross" Size="4" Radius="4" StrokeWidth="0" />
                            </ext:LineSeries>
    
                            <ext:LineSeries Axis="Left" Smooth="3" XField="Name" YField="Data2">
                                <HighlightConfig Size="7" Radius="7" />
                                <MarkerConfig Type="Circle" Size="4" Radius="4" StrokeWidth="0" />
                            </ext:LineSeries>
    
                            <ext:LineSeries Axis="Left" Smooth="3" Fill="true" XField="Name" YField="Data3">
                                <HighlightConfig Size="7" Radius="7" />
                                <MarkerConfig Type="Circle" Size="4" Radius="4" StrokeWidth="0" />
                            </ext:LineSeries>
                        </Series>
                    </ext:Chart>
                </Items>
            </ext:Panel>
        </form>    
    </body>
    </html>
    The err
    Last edited by fabricio.murta; May 15, 2017 at 7:18 PM.
  2. #2
    Hello @feanor91!

    Quote Originally Posted by feanor91
    PROBLEM SOLVED, PLEASE CLOSE AND FORGET. I SIMPLY REMOVE AND ADD SEVERAL TIMES EXT LIBRARIES FROM THE SOLUTION AND I MANAGE TO MAKE IT WORKING...ANOTHER KIND OF MAGIC I GUESS.
    Strange, but sometimes happens, specially true when dealing with user controls.

    You could have added that edit message as a reply of your thread for clarity. Thanks for sharing -- albeit magic -- the solution that made it work for you. Sometimes these "magic fixes" can be fast-forwarded by trying to run the sample in a fresh project. But note the "sometimes".

    But glad in the end you could have it working, I hope it does not break again! :)
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 3
    Last Post: Mar 09, 2017, 2:04 PM
  2. Replies: 4
    Last Post: May 01, 2014, 7:06 AM
  3. Replies: 7
    Last Post: Oct 15, 2013, 11:35 AM
  4. Replies: 1
    Last Post: Feb 28, 2011, 8:13 AM
  5. Replies: 4
    Last Post: Feb 01, 2011, 11:54 AM

Posting Permissions