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

Populate Chart from RadGrid headers

3 Answers 61 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Kurt Kluth
Top achievements
Rank 1
Kurt Kluth asked on 09 Jul 2015, 07:52 PM

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.

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Kurt Kluth
Top achievements
Rank 1
answered on 09 Jul 2015, 07:54 PM

<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()
 

 

 

0
Kurt Kluth
Top achievements
Rank 1
answered on 13 Jul 2015, 07:21 PM

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

0
Danail Vasilev
Telerik team
answered on 14 Jul 2015, 08:12 AM
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
Tags
Chart (HTML5)
Asked by
Kurt Kluth
Top achievements
Rank 1
Answers by
Kurt Kluth
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or