Stacked Columns - Y-axis grows logarithmically with each new series

2 posts, 0 answers
  1. dan
    dan avatar
    11 posts
    Member since:
    Jul 2017

    Posted 19 Mar Link to this post

    I'm having an issue I can't find any similar posts to so here goes.

    I am generating a pivot table using Linq where I won't know the column names until run-time.  So I am creating the data series in codebdhind and then binding the Radhtmlchart to the data table.  Things work somewhat well but for one problem.  Each new series I add changes the Y-Axis scale by a factor of 10.  I have added images below to show how it grows (data points are set to 1 or 2 in each case for simplicity).  Note that the Y-axis grows from roughly 1 to 10 to 100 and the column height of each successive series is correspondingly bigger. 

    Here is the aspx for the Chart:

    <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server">
        <PlotArea>
            <XAxis DataLabelsField="DayHour">
                <LabelsAppearance Step="4">
                </LabelsAppearance>
            </XAxis>
            <YAxis Type="Numeric">
                <LabelsAppearance Step="1">
                </LabelsAppearance>
            </YAxis>
        </PlotArea>
        <Appearance>
            <FillStyle BackgroundColor="Transparent"></FillStyle>
        </Appearance>
        <ChartTitle Text="Hourly Clicks">
            <Appearance Align="Center" BackgroundColor="Transparent" Position="Top">
                <TextStyle Bold="true" FontSize="24px" />
            </Appearance>
        </ChartTitle>
        <Legend>
            <Appearance BackgroundColor="Transparent" Position="Bottom"></Appearance>
        </Legend>
    </telerik:RadHtmlChart>

     

    And here is the codebehind where I generate the ColumnSeries dynamically and bind.  There is some code to test different configurations of the 'stacked' attribute based on some older articles I saw but it was not helpful.  T is the Data Table and looks exactly as it should.

    int i = T.Columns.Count;
    bool bstacked = true;
    foreach (DataColumn col in T.Columns)
    {
        if (col.ColumnName == "DayHour") continue;
        ColumnSeries newSeries = new ColumnSeries();
        newSeries.Name = col.ColumnName;
        newSeries.GroupName = "colGroup";
        newSeries.DataFieldY = col.ColumnName;
        i--;
        if (i == 1) bstacked = false;
        newSeries.Stacked = bstacked;
        newSeries.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd;
        RadHtmlChart1.PlotArea.Series.Add(newSeries);
    }
    RadHtmlChart1.DataSource = T;
    RadHtmlChart1.DataBind();

     

    I would appreciate any help with this.  

    Thanks.

  2. Rumen
    Admin
    Rumen avatar
    14107 posts

    Posted 22 Mar Link to this post

    Hi Dan,

    The following sentence from your ticket on the same topic:

    "Still having this issue with my data (not the generic data though)"

    makes us think that something breaks the serialization. 

    This is probably due to some special characters in the field names - as the special symbols in the series names we found in the other ticket.

    Since you are using Linq, what you can do is call .Take (n) as a debugging technique. The Take method, returns a specified number of contiguous elements from the start of a sequence and so you'll begin to take only the first "n" lines and this will show on which row starts the problem. 

    If that does not help, the other most likely reason for the problem could be the names of the fields. Make sure that all of them start with a letter (not a number or special character) and that there aren't dashes in them.

    Best regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top