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

RadHtmlChart Pie Chart LabelsAppearance value

4 Answers 586 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 30 Jun 2015, 09:25 PM

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

 

Example:

TooltipAppearance = percentage value.  actual count/total count

LabelAppearance = actual count

 

4 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 02 Jul 2015, 07:44 AM
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
0
Joseph
Top achievements
Rank 1
answered on 09 Jul 2015, 05:22 PM

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

0
Joseph
Top achievements
Rank 1
answered on 10 Jul 2015, 08:50 PM

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

0
Danail Vasilev
Telerik team
answered on 14 Jul 2015, 06:55 AM
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
Tags
General Discussions
Asked by
Joseph
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Joseph
Top achievements
Rank 1
Share this question
or