locked
Ajaxtoolkits Piechart RRS feed

  • Question

  • User944339287 posted

    Hi guys.. not sure why the pie chart show not properly. 

    Meanwhile... 
    1) how do i change background color of each value from codebehind? TQ
    2) can i show USD1,340 instead of 1340 in my piechart?

    CURRENT RESULT


    CODE BEHIND

        Private Sub BindChart()
    
            Me.PieChart1.PieChartValues.Add(New AjaxControlToolkit.PieChartValue() With { _
                .Category = "Income", _
                .Data = "2580.00" _
            })
    
            Me.PieChart1.PieChartValues.Add(New AjaxControlToolkit.PieChartValue() With { _
                .Category = "Expenses", _
                .Data = "1340.00" _
            })
    
        End Sub

    HTML MAKRUP

    <cc1:PieChart ID="PieChart1" runat="server" ChartHeight="300" ChartWidth="300"  ChartType="Column" ChartTitleColor="#0E426C">
    </cc1:PieChart>



    Monday, February 12, 2018 10:04 AM

All replies

  • User-1838255255 posted

    Hi kengkit,

    According to your description, as far as i know, you could change the value background in code behind, but the value is need int format, so we can not show string format in it. 

    Please the following sample code:

     

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
            </cc1:ToolkitScriptManager>
    
            <cc1:PieChart ID="PieChart1" runat="server" ChartHeight="300" ChartWidth="300"
                ChartType="Column" ChartTitleColor="#0E426C" Visible="false">
            </cc1:PieChart>
    
        </form>
    </body>
    </html>
    
     Dim colors As String() = New String() {"Yellow", "SkyBlue"}
    
            Me.PieChart1.PieChartValues.Add(New AjaxControlToolkit.PieChartValue() With { _
                .Category = "Income", _
                .PieChartValueColor = colors(0), _
                .Data = "2580.00" _
            })
    
            Me.PieChart1.PieChartValues.Add(New AjaxControlToolkit.PieChartValue() With { _
                .Category = "Amount", _
                .PieChartValueColor = colors(1), _
                .Data = "2580.00" _
            })
            PieChart1.Visible = True
        End Sub

    Result:

    Best Regards,

    Eric Du 

    Tuesday, February 13, 2018 6:09 AM
  • User944339287 posted

    thanks!

    FYI... the pie chart show properly is using same value (2580 / 2580)

    but the problem still remained if value is (1500 / 2500)

    Please advise. TQ

    Tuesday, February 13, 2018 7:00 AM
  • User-1838255255 posted

    Hi kengkit,

    I have make a test in my side, really exist this issue when value difference is big. I am not sure is it a bug? Because Ajaxtoolkits PieChart is the third tool, so i think you could confirm it in this forum: 

    https://www.devexpress.com/Support/Center/Question/List/1 

    i think if this is a bug, you could report the bug in this site:

    https://community.devexpress.com/blogs/aspnet/archive/2015/01/22/asp-net-ajax-control-toolkit-how-to-report-issues.aspx 

    Best Regards,

    Eric Du 

    Tuesday, February 13, 2018 9:43 AM