How can i add <Tips .. <rerender fn='function' /> in piechart in code-behind

  1. #1

    How can i add <Tips .. <rerender fn='function' /> in piechart in code-behind

    Hi guys.
    I want to create PieChart in code-behind. But i has a problem, i don't know how can i add tips in c#


    Demo in http://examples2.ext.net/#/Chart/Pie/Basic/
    <ext:Chart
                        ID="Chart1" 
                        runat="server"
                        Animate="true"
                        Shadow="true"
                        InsetPadding="60"
                        Theme="Base:gradients">
                        <LegendConfig Position="Right" />
                        <Store>
                            <ext:Store 
                                runat="server" 
                                Data="<%# Ext.Net.Examples.ChartData.GenerateData(6) %>" 
                                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">
                                    <Renderer Fn="tipRenderer" />
                                </Tips>
                            </ext:PieSeries>
                        </Series>
                    </ext:Chart
    I want to add function in code-behind, but i can't
    <Tips TrackMouse="true" Width="140" Height="28">
                                    <Renderer Fn="tipRenderer" />
                                </Tips>

    Here is my code
    Code-behind
    public Chart fn_Generate_PieChart(string ID, DataTable dtData)
        {
            Chart pieChart = new Chart() { ID = ID, Animate = true, Shadow = true, InsetPadding = 10, Legend = false, Border = false, Region = Region.Center };
            Store st = new Store() { ID = "st" + ID, AutoDataBind = true };
            Model md = new Model() { ID = "md" + ID };
            ModelField m1 = new ModelField() { Name = "Name" };
            ModelField m2 = new ModelField() { Name = "Data" };
            md.Fields.Add(m1); md.Fields.Add(m2);
            st.Model.Add(md);
            st.DataSource = dtData;
            pieChart.Store.Add(st);
            pieChart.Series.Add(new PieSeries()
            {
                AngleField = "Data",
                ShowInLegend = true,
                Donut = 0,
                Highlight = true,
                HighlightSegmentMargin = 20,
                Label = new SeriesLabel()
                {
                    Field = new string[] { "Name" },
                    Display = SeriesLabelDisplay.Rotate,
                    Contrast = true,
                    Font = "14px Tahoma"
                },
                Tips = new ChartTip()
                {
                    TrackMouse = true,
    
                    //How can i do that.
                    //<Renderer Fn="tipRenderer" />
                }
            });
            return pieChart;
        }
    Please help me

    Thanks.
  2. #2
    Hi @dinhhung09138,

    Here you are.
    Tips = new ChartTip()
    {
        TrackMouse = true,
        Renderer = 
        {
            Fn = "tipRenderer"
        }
    }
  3. #3
    Thanks @Daniill

    It's work be fine.

Similar Threads

  1. [CLOSED] Renderer on Tips of Series of Chart in code behind
    By reinout.mechant@imprss.be in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 21, 2013, 3:29 PM
  2. [CLOSED] Transparency of colors in PieChart but not in legend
    By HansWapenaar in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 25, 2013, 9:05 AM
  3. [CLOSED] PieChart rendering problem in IE10
    By HansWapenaar in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 24, 2013, 7:52 PM
  4. how to call code behind function through grid
    By harshad.jadhav in forum 1.x Help
    Replies: 1
    Last Post: Jul 10, 2010, 9:01 AM
  5. Assain a "code behind" function to a key?
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 26, 2008, 8:13 AM

Tags for this Thread

Posting Permissions