RadHtmlChart Pie Chart LabelsAppearance value

5 posts, 0 answers
  1. Joseph
    Joseph avatar
    29 posts
    Member since:
    Jun 2014

    Posted 30 Jun 2015 Link to this post

    Is it possible to display the LabelsAppearance value different from TooltipsAppearance?

     

    Example:

    TooltipAppearance = percentage value.  actual count/total count

    LabelAppearance = actual count

     

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 02 Jul 2015 Link to this post

    Hi Joseph,

    You can data-bind the chart and use templates to show additional data source fields inside tooltips/labels. See details in our demos (http://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/clienttemplates/defaultcs.aspx) and documentation (http://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/functionality/clienttemplate/overview).

    You may also find useful this kb - http://www.telerik.com/support/kb/aspnet-ajax/chart-%28html5%29/details/displaying-grand-total-in-stacked-series-labels-and-pie-series-legend

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Joseph
    Joseph avatar
    29 posts
    Member since:
    Jun 2014

    Posted 09 Jul 2015 in reply to Danail Vasilev Link to this post

    Ok lets change this around.  Is there a way to make TooltipAppearance into text programatically?  Below is my example:

     

    <telerik:RadHtmlChart runat="server" ID="Chart_TotalImpressions" Width="425" Height="425" BorderWidth="0" Transitions="true" Skin="Vista" >
                                    <Appearance><FillStyle BackgroundColor="White" /></Appearance>
                                    <Legend><Appearance BackgroundColor="White" Position="bottom" Visible="true"></Appearance></Legend>
                                    <PlotArea><Appearance><FillStyle BackgroundColor="White"></FillStyle><TextStyle Margin="-5 -5 -5 -5" /></Appearance></PlotArea>
                                </telerik:RadHtmlChart>

     

    Private Sub LoadImpressionPieChart()
            Dim dtIYPDashboard As DataTable
            dtIYPDashboard = CType(ViewState("CatInfoImp"), DataTable)
            Dim ClickSeriesItem As New PieSeriesItem
            Dim ClickSeries As New PieSeries
            Dim PubName As String = ""
     
            Dim clsPublisher As New YPMNetBLL.clsPublisher
            Dim clsMisc As New clsMisc
     
            Dim ImpressionPercentage As Decimal
     
            If dtIYPDashboard IsNot Nothing Then
                Dim TotalImpressions As Decimal
     
                For Each dr1 In dtIYPDashboard.Rows
                    If IsDBNull(dr1("ImpressionCount")) = False Then
                        TotalImpressions += CDec(dr1("ImpressionCount"))
                    End If
                Next
                If dtIYPDashboard IsNot Nothing Then
                    ClickSeries = New PieSeries
                    ClickSeries.StartAngle = "90"
                    ClickSeries.LabelsAppearance.Visible = False
                    ClickSeries.TooltipsAppearance.BackgroundColor = Drawing.Color.SkyBlue
                    For Each dr In dtIYPDashboard.Rows
                        ClickSeriesItem = New PieSeriesItem
                        If TotalImpressions > 0 Then
                            ImpressionPercentage = dr("ImpressionCount")
                            'ImpressionPercentage = Math.Round((CDec(dr("ImpressionCount")) / TotalImpressions * 100), 2)
                        Else
                            ImpressionPercentage = 0
                        End If
     
                        If ImpressionPercentage > 0 Then
                            ClickSeriesItem.Name = dr("CategoryName")
                            ClickSeriesItem.Y = ImpressionPercentage
                            ClickSeries.SeriesItems.Add(ClickSeriesItem)
                        End If
                    Next
                End If
                Chart_TotalImpressions.PlotArea.Series.Add(ClickSeries)
                Chart_TotalImpressions.ChartTitle.Appearance.TextStyle.Padding = "4"
                Chart_TotalImpressions.ChartTitle.Appearance.TextStyle.Color = System.Drawing.Color.FromArgb(51, 104, 159)
                Chart_TotalImpressions.ChartTitle.Appearance.TextStyle.FontSize = "14"
            End If
        End Sub

  5. Joseph
    Joseph avatar
    29 posts
    Member since:
    Jun 2014

    Posted 10 Jul 2015 in reply to Danail Vasilev Link to this post

    I also tried it this way and i'm not displaying data.  Please advice.

     

    <telerik:RadHtmlChart runat="server" ID="Chart_TotalImpressions" Width="425" Height="425" BorderWidth="0" Transitions="true" Skin="Vista" >
                                    <Appearance><FillStyle BackgroundColor="White" /></Appearance>
                                    <Legend><Appearance BackgroundColor="White" Position="bottom" Visible="true"></Appearance></Legend>
                                    <PlotArea>
                                        <Appearance>
                                            <FillStyle BackgroundColor="White"></FillStyle><TextStyle Margin="-5 -5 -5 -5" />
                                        </Appearance>
                                        <Series>
                                            <telerik:PieSeries DataFieldY="ImpressionCount" Name="CategoryName" NameField="CategoryName">
                                                <LabelsAppearance>
                                                    <ClientTemplate>#=dataItem.CategoryName#</ClientTemplate>
                                                </LabelsAppearance>
                                                <TooltipsAppearance Color="Yellow">
                                                    <ClientTemplate>#=dataItem.CategoryName#<br />#=dataItem.ImpressionCount#</ClientTemplate>
                                                </TooltipsAppearance>
                                                <SeriesItems></SeriesItems>
                                            </telerik:PieSeries>
                                        </Series>
                                    </PlotArea>
                                </telerik:RadHtmlChart>

     

    Private Sub LoadImpressionPieChart()
            Dim dtIYPDashboard As DataTable
            dtIYPDashboard = CType(ViewState("CatInfoImp"), DataTable)
            Chart_TotalImpressions.DataSource = dtIYPDashboard
            Chart_TotalImpressions.DataBind()
     
            If dtIYPDashboard IsNot Nothing Then
                Chart_TotalImpressions.ChartTitle.Appearance.TextStyle.Padding = "4"
                Chart_TotalImpressions.ChartTitle.Appearance.TextStyle.Color = System.Drawing.Color.FromArgb(51, 104, 159)
                Chart_TotalImpressions.ChartTitle.Appearance.TextStyle.FontSize = "14"
            End If
        End Sub

  6. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 14 Jul 2015 Link to this post

    Hi Joseph,

    The code and the markup look fine at first glance. Can you try to hard code some dummy data source (e.g. , a DataTable data source) and then provide it back to us, so that we can run the example, reproduce the issue and see where does the problem come from?

    On a side note - if you want to display custom text in the tooltips/labels you should data-bind the chart and use templates. That being said you can consider the code from your last post.

    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
UI for ASP.NET Ajax is Ready for VS 2017