This is a migrated thread and some comments may be shown as answers.

x axis values mixed strings and ints

7 Answers 69 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
debett
Top achievements
Rank 1
debett asked on 07 Apr 2011, 04:54 PM
Hi all,

I have found out that when my data for x axis has mixed string and int values (even though they come in as "strings'" from the DB), I get an exception "Input string was not in a correct format." Looking at the call stack I see that it fails converting ToDouble.

Do you know any workarounds?

Note, this is a generic/dynamic solution, so I don't know what kind of data comes in. I allow users to select fields on the fly which they want to display on the chart. Then, I have code to populate the grid:

qbChart.Series.Clear();
t
his.qbChart.DataGroupColumn = this.ddlGroup.SelectedValue;
this.qbChart.PlotArea.XAxis.DataLabelsColumn = this.ddlX.SelectedValue;
sdsResults.ConnectionString = cm.css.ConnectionString;
sdsResults.SelectCommand = SQLString;             
this.qbChart.DataBind();

I would like to stick with sql datasource. IAlso, I do not have an option to convert values to int in DB.

Thank you.

7 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 08 Apr 2011, 11:02 AM
Hello debett,

Could you elaborate a bit more on your specific scenario? We tried to reproduce the problem based on your guidelines but our efforts were unsuccessful so far -- could you review the attached sample application and let us know whether we are missing some key component that would trigger the erroneous behavior?

Looking forward to your reply.


Regards,
Giuseppe
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
debett
Top achievements
Rank 1
answered on 08 Apr 2011, 01:43 PM
Giuseppe,

I have changed the data in your example and it fails:) I cannot attach here the complete project, but I'll list 2 files:

Code:

protected void Page_Load(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        this.RadChart1.Series.Clear();
        this.RadChart1.DataGroupColumn = "Item2";
        this.RadChart1.PlotArea.XAxis.DataLabelsColumn = "Item1";
        this.RadChart1.DataSource = this.Data;
        this.RadChart1.DataManager.ValuesYColumns = new string[] { "Item3" };
        this.RadChart1.DataBind();
         
    }
}
 
 
public List<Tuple<string,string, string >> Data
{
    get
    {
        return new List<Tuple<string, string, string>>()
                   {new Tuple<string, string, string>(null, null, "1"),
                       new Tuple<string, string, string>(null, "F", "26"),
                       new Tuple<string, string, string>(null, "M", "48"),
 
                       new Tuple<string, string, string>("01", "F", "27"),
                       new Tuple<string, string, string>("01", "M", "21"),
                       new Tuple<string, string, string>("02", "F", "19"),
                       new Tuple<string, string, string>("02", "M", "23"),
 
                       new Tuple<string, string, string>("K", "F", "35"),
                       new Tuple<string, string, string>("K", "M", "29"),
                   };
    }
}


Behind:

<telerik:RadChart ID="RadChart1" runat="server">
        </telerik:RadChart>

Please, let me know if you need more info.


Thank you.
0
Yavor
Telerik team
answered on 13 Apr 2011, 07:42 AM
Hello debett,

Our system indicates, that you have opened an identical ticket on the same issue. To avoid duplicate posts, we can continue our communication in the support ticket in question, which will be addressed shortly.

Kind regards,
Yavor
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Boris
Top achievements
Rank 1
answered on 26 Sep 2011, 08:49 AM
HI,
I have the same problem i need to set to x-axis mixed types (int and string) and i get an error :
"Input string was not in a correct format"
Did find solution for debett and mine problem?

0
Yavor
Telerik team
answered on 28 Sep 2011, 08:08 AM
Hello Boris,

Are you applying any format strings to the values? Also, are all the values along the xAxis properly populated? Any additional information on your precise setup will help us better address the question set forth.

All the best,
Yavor
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Boris
Top achievements
Rank 1
answered on 28 Sep 2011, 09:36 AM
Hello Yavor,
I'm not applying any format strings to the values.
And all the values populated.
I use x axis to show user info, an ID of the user (304411111 - int or string)  or a name of the user (Boris - string).
Depending on user role he can see for some users their name and for other only their ID .
If I set only the ID to all users or only names this works fine, but when I mixed and show some users an ID and some Names
It give me an error "Input string was not in a correct format"

Thank's!
0
Yavor
Telerik team
answered on 03 Oct 2011, 06:52 AM
Hi Boris,

Based on the supplied information, it is hard to determine what is causing the exception.
If the problem persists, it will be best if you open a formal support ticket, and send us a small working project, demonstrating your setup, and showing the unwanted exception, for additional review and testing.

Best wishes,
Yavor
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Chart (Obsolete)
Asked by
debett
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
debett
Top achievements
Rank 1
Yavor
Telerik team
Boris
Top achievements
Rank 1
Share this question
or