Populate Chart from RadGrid headers

4 posts, 0 answers
  1. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 09 Jul 2015 Link to this post

    I would like to allow a user to click on a column header (ie Total Assets, Total Shares, etc) within my RadGrid and then populate the HtmlChart.  Is this possible or could you suggest another method?  The Y axis (amounts [$ or %]) would change dynamically while X axis (dates) would remain static.

     

     

     

     

     

     

  2. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 09 Jul 2015 in reply to Kurt Kluth Link to this post

    <telerik:RadGrid ID="grdResults" runat="server">
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling>
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="false" TableLayout="Fixed">
            <Columns>
                <telerik:GridBoundColumn DataField="Cycle_Date" HeaderText="Cycle Date" UniqueName="Cycle_Date" DataFormatString="{0:d}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="_799" HeaderText="Total Assets" UniqueName="_799" DataFormatString="{0:c}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="_920D" HeaderText="Total Shares" UniqueName="_920D" DataFormatString="{0:c}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="_970" HeaderText="Net Capital" UniqueName="_970" DataFormatString="{0:c}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="_718" HeaderText="Total Loans" UniqueName="_718" DataFormatString="{0:c}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="_719" HeaderText="Allowance for Loan Losses" UniqueName="_719" DataFormatString="{0:c}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="_605B" HeaderText="Total Deliquency - Delinquent Loans (>2 mo)" UniqueName="_605B" DataFormatString="{0:c}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="netcapitalAssets" HeaderText="Net Capital Ratio" UniqueName="netcapitalAssets" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="delLoans" HeaderText="Delinquency Ratio" UniqueName="delLoans" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="poaOperatingExpenses" HeaderText="Oper. Expenses" UniqueName="poaOperatingExpenses" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="netIncome" HeaderText="Net Income/Loss" UniqueName="netIncome" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="chgoffLoans" HeaderText="Net Charge-Offs/Avg. Loans" UniqueName="chgoffLoans" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CoverageRatio" HeaderText="Coverage Ratio (ALL-to-Delq)" UniqueName="CoverageRatio" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="InterestMargin" HeaderText="Interest Margin" UniqueName="InterestMargin" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="poaOtherIncome" HeaderText="Other Income" UniqueName="poaOtherIncome" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="poaProvLL" HeaderText="Provision for Loan Losses" UniqueName="poaProvLL" DataFormatString="{0:P3}">
                    <HeaderStyle Width="115px" />
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    oConn.Open()
    Dim ocmd As New SqlCommand("sp_seTrendTracking", oConn)
    ocmd.CommandType = CommandType.StoredProcedure
     
    With ocmd.Parameters
        '.Add(New SqlParameter("@charter_num", Session("cuCharter_Num")))
        .Add(New SqlParameter("@charter_num", 95778))
    End With
     
    reader = ocmd.ExecuteReader
    If reader.HasRows Then
        Me.grdResults.DataSource = reader
        Me.grdResults.DataBind()
        oConn.Close()
     

     

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 13 Jul 2015 Link to this post

    Ending up finding VB.net function that will take my queried result, place it in a data table and the function will transpose the data.

    Function GetTransposedTable(ByVal dtOriginal As DataTable) As DataTable
        Dim dtReflection As New DataTable("Reflection")
        For i As Integer = 0 To dtOriginal.Rows.Count - 1
            dtReflection.Columns.Add(dtOriginal.Rows(i)(0))
        Next
        Dim row As DataRow
        For j As Integer = 1 To dtOriginal.Columns.Count - 1
            row = dtReflection.NewRow
            For k As Integer = 0 To dtOriginal.Rows.Count - 1
                If j <= 6 Then
                    row(k) = String.Format("{0:c0}", dtOriginal.Rows(k)(j))
                Else
                    row(k) = String.Format("{0:p3}", dtOriginal.Rows(k)(j))
                End If
     
            Next
            dtReflection.Rows.Add(row)
        Next
     
        Return dtReflection
    End Function

  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 14 Jul 2015 Link to this post

    Hi Kurt,

    You can attach to the corresponding client-side event of the grid where you can initiate an AJAX request to create the chart either programmatically or data-bind it.

    Regards,
    Danail Vasilev
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top