English 中文(简体)
未在复读后展示的高档
原标题:Highcharts not displaying after refresh

I am using high charts and has got success in displaying them on a page reload. I am creating the chart on server side using the following code:-

DateTime dt = DateTime.Now;
Series[] series=null;

            Series Store1 = new Series();
            Store1.Data = new Data(new object[]
                                  {
                                      lst[0].target1,lst[0].target2,lst[0].target3,lst[0].target4,lst[0].target5,lst[0].target6,lst[0].target7
                                  });

            Store1.Name = lst[0].StoreName;
            Store1.Type = DotNet.Highcharts.Enums.ChartTypes.Bar;

            Series Store2 = new Series();
            Store2.Data = new Data(new object[]
                                  {
                                      lst[1].target1,lst[1].target2,lst[1].target3,lst[1].target4,lst[1].target5,lst[1].target6,lst[1].target7
                                  });
            Store2.Name = lst[1].StoreName;
            Store2.Type = DotNet.Highcharts.Enums.ChartTypes.Bar;

            series = new Series[] { Store1, Store2 };

            DotNet.Highcharts.Highcharts bar = new DotNet.Highcharts.Highcharts("chart")
            .SetPlotOptions(new PlotOptions
            {
                Bar = new PlotOptionsBar
                {
                    AllowPointSelect = true,                   
                    Cursor = DotNet.Highcharts.Enums.Cursors.Pointer,
                    ShowInLegend = true,
                    DataLabels = new PlotOptionsBarDataLabels
                    {
                        Color = System.Drawing.ColorTranslator.FromHtml("#000000"),
                        //ConnectorColor = System.Drawing.ColorTranslator.FromHtml("#000000"),
                    }
                }
            }) 
            .SetLegend(new Legend{
            Layout=DotNet.Highcharts.Enums.Layouts.Vertical
            })
                .SetXAxis(new XAxis
                {
                    Categories = new string[] {dt.DayOfWeek.ToString(),
                    dt.AddDays(-1).DayOfWeek.ToString(),
                    dt.AddDays(-2).DayOfWeek.ToString(),
                    dt.AddDays(-3).DayOfWeek.ToString(),
                    dt.AddDays(-4).DayOfWeek.ToString(),
                    dt.AddDays(-5).DayOfWeek.ToString(),
                    dt.AddDays(-6).DayOfWeek.ToString()
                    }
                })
            .SetTitle(new Title { Text = "Store Details" })
            .SetSeries(series);

            ltrchart.Text = bar.ToHtmlString();

Cliend Secret Code

<script src="Js/jquery-1.5.1.js" type="text/javascript"></script>
<script src="Js/highcharts.js" type="text/javascript"></script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
    <asp:Literal ID="ltrchart" runat="server"></asp:Literal>        
</ContentTemplate>
</asp:UpdatePanel>

I am using an update panel but whenever i refresh my chart disappears. If i reload the page it is working fine but when i try and change the graph without putting it in update panel it doesn t change. I want to use update panel and want my graph to change and not disappear. I am not getting any errors neither server side nor client side. Please help me with the same.

Regards Abhishek

问题回答

能够重新上载图表但不能再上数据点。

有一个客户方面,你需要将此补充到法典中。

Sys.Application.add_load( // Chart rendering code here )

这将使图表在更新小组后重新发布。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签