Results 1 to 1 of 1

Thread: Pie chart example

  1. #1
    Gamerome
    Guest

    [Resolved] Pie chart example

    Hello,

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

    Code:
    <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:

    Code:
    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
    Gamerome
    Guest
    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
    Ext.NET - Dev Team Vladimir's Avatar
    Join Date
    Mar 2008
    Location
    Russia
    Posts
    15,124
    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
    Ext.NET, Inc.
    Development Team

    Ext.NET Examples | Ext.NET API Docs | ExtJS API Docs | Twitter | Jobs

Similar Threads

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

Tags for this Thread

Posting Permissions