The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

Pie chart example

  1. #1

    [Resolved] Pie chart example

    Hello,

    I'm trying to use Pie chart example but it doesn't work with me.
    Code is very simple...

    <ext:Chart ID="Chart1" runat="server" Animate="true" Shadow="true" InsetPadding="60"
                Theme="Base:gradients">
                <LegendConfig Position="Right" />
                <Store>
                            <ext:Store  
                                runat="server"    
                                Data="<%# GenerateData() %>"                          
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="Name" />
                                            <ext:ModelField Name="Data1" />
                                        </Fields>
                                    </ext:Model>
                                </Model>                            
                            </ext:Store>
                        </Store>
                        <Series>
                            <ext:PieSeries 
                                AngleField="Data1" 
                                ShowInLegend="true" 
                                Donut="0" 
                                Highlight="true" 
                                HighlightSegmentMargin="20">
                                <Label Field="Name" Display="Rotate" Contrast="true" Font="18px Arial" />
                                <Tips TrackMouse="true" Width="140" Height="28" runat="server">
                                    <Renderer Fn="tipRenderer" />
                                </Tips>
                            </ext:PieSeries>
                        </Series>
            </ext:Chart>
    And the code behind:

    
    Partial Class _Default
        Inherits System.Web.UI.Page
    
        Public Class ChartItem
            Public Name As String
            Public Data1 As Double
            Public Data2 As Double
            Public Data3 As Double
        End Class
    
        Public Sub refreshPie()
            Chart1.GetStore().DataSource = GenerateData()
            Chart1.GetStore().DataBind()
        End Sub
    
        Public Function GenerateData() As List(Of ChartItem)
            Dim chartsData As New List(Of ChartItem)(2)
    
            chartsData.Add(New ChartItem() With {.Name = "test", .Data1 = 20, .Data2 = 10, .Data3 = 33})
            chartsData.Add(New ChartItem() With {.Name = "test2", .Data1 = 80, .Data2 = 90, .Data3 = 77})
    
            Return chartsData
        End Function
    End Class

    I don"t have any js errors. I really don't understand why I don't see anything. Page is still blank...

    Can you help me please? :(
  2. #2
    Okay...I've found myself the problem...
    No render if the chart isn't included into a Panel for example..... Stupid error -_-'
    Sorry.
  3. #3
    Including to a panel is not required. You have to provide width/height for a chart or place it inside a container with a layout handles subitems size (like FitLayout)
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. Replies: 2
    Last Post: Aug 13, 2012, 3:12 PM
  2. Updatepanel and ext:Chart
    By Frenks in forum 2.x Help
    Replies: 3
    Last Post: Aug 01, 2012, 9:54 AM
  3. This is a bug?Chart problem···
    By jiaxiang8756 in forum 2.x Help
    Replies: 4
    Last Post: Jul 17, 2012, 8:14 PM
  4. Replies: 1
    Last Post: Jun 02, 2012, 8:12 AM
  5. Chart
    By zanotto in forum 2.x Help
    Replies: 7
    Last Post: Mar 09, 2012, 12:47 PM

Tags for this Thread

Posting Permissions

Subscribe now to get the latest Ext.NET happenings in our newsletter.