首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Telerik RadChart保持加载

Telerik RadChart保持加载
EN

Stack Overflow用户
提问于 2012-10-19 19:39:53
回答 1查看 616关注 0票数 0

我有一个问题,我的RadChart在本地加载得很好,但在我部署它之后,它只是继续加载,而不是运行。我没有进入实际的图表屏幕。

我在整个过程之后放了一个消息框,然后这个消息框就出现了,所以我确信代码已经到了尽头。我只是不知道为什么屏幕不能完成加载。

有什么想法吗?

代码:

代码语言:javascript
复制
protected void btnSearch_OnClick(object sender, ImageClickEventArgs e) {

            try
            {

                RadChartPOByFactory.Chart.Series.RemoveSeries();

                RadChartPOByFactory.ClientSettings.ScrollMode = Telerik.Web.UI.ChartClientScrollMode.Both;

                RadChartPOByFactory.DataManager.ValuesXColumn = "FactoryID";
                RadChartPOByFactory.DataManager.ValuesYColumns = new String[] { "Value" };
                RadChartPOByFactory.DataGroupColumn = "Year";
                RadChartPOByFactory.PlotArea.XAxis.DataLabelsColumn = "Factory";
                RadChartPOByFactory.Legend.Appearance.GroupNameFormat = "#VALUE";

                RadChartPOByFactory.PlotArea.YAxis.Appearance.CustomFormat = "$#,##0,,.00M;;K";

                var poReportRawData = from r in report.GetPOHeader_POByFactory_Report(ddlYearFrom.SelectedValue, ddlYearTo.SelectedValue) 
                                      select new { 
                                          Year = r.Year.ToString(), 
                                          Factory = r.Factory, 
                                          Value = r.AmountWithDiscount.Value };

                var factoryRawIDs = (from f in poReportRawData select f.Factory).Distinct();
                List<ListItem> factoryIDs = new List<ListItem>();
                int i = 1;
                foreach (string s in factoryRawIDs.ToList())
                {
                    factoryIDs.Add(new ListItem(s, i.ToString()));
                    i++;
                }

                var poReportData = from po in poReportRawData.ToList() 
                                   select new { 
                                       Year = po.Year, 
                                       FactoryID = factoryIDs.Where(f => f.Text == po.Factory).FirstOrDefault().Value, 
                                       Value = po.Value, 
                                       Factory = po.Factory };

                RadChartPOByFactory.DataSource = poReportData.ToList();
                RadChartPOByFactory.DataBind();

                foreach (ChartSeries cs in RadChartPOByFactory.Series)
                {   
                    cs.DefaultLabelValue = "$#Y{#,##0,}K (#%{#0.###%})";

                    cs.Appearance.LabelAppearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Inside;
                    cs.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.Center;
                    cs.Appearance.LabelAppearance.RotationAngle = 0;

                }

                RadChartPOByFactory.Visible = true;
            }
            catch(ExceptionHandler ex)
            {
                WriteJSHandledException(ex);
            }

        }

并且这段代码也在运行:

代码语言:javascript
复制
protected void RadChartPOByFactory_OnBeforeLayout(object sender, System.EventArgs e) {

            foreach (Telerik.Charting.LabelItem RadChartLegendLabelItem in RadChartPOByFactory.Legend.Items.OrderBy(a=>a.Name)) {
                //Remove the top-most item (which then decrements the item count of the legend) 
                RadChartPOByFactory.Legend.Items.RemoveAt(0);
                //Insert the new (reversed) legend item at the end of the list 
                RadChartPOByFactory.Legend.Items.Insert(RadChartPOByFactory.Legend.Items.Count, RadChartLegendLabelItem);
            }


            foreach (Telerik.Charting.ChartSeries RadChartSerie in RadChartPOByFactory.Chart.Series.OrderBy(a => a.Name)) {

                RadChartSerie.Items.OrderBy(a => a.Parent.Name);

                //Remove the top-most item (which then decrements the item count of the legend) 
                RadChartPOByFactory.Chart.Series.RemoveAt(0);
                //Insert the new (reversed) legend item at the end of the list 
                RadChartPOByFactory.Chart.Series.Insert(RadChartPOByFactory.Chart.Series.Count, RadChartSerie);

            }

            foreach (Telerik.Charting.ChartSeries RadChartSerie in RadChartPOByFactory.Chart.Series.OrderBy(a => a.Name)) {

                foreach (ChartSeriesItem RadChartSerieItem in RadChartSerie.Items.OrderBy(b => b.Name)) {
                    //Remove the top-most item (which then decrements the item count of the legend) 
                    RadChartSerie.Items.RemoveAt(0);
                    //Insert the new (reversed) legend item at the end of the list 

                    string tmpTextBlock = RadChartSerieItem.Label.TextBlock.Text;
                    string[] toMillion = tmpTextBlock.Split(' ');

                    string tmpValue = toMillion[0].Substring(1, toMillion[0].Length - 2);
                    decimal tmpInt = decimal.Parse(tmpValue);

                    if (tmpInt >= 1000) {
                        RadChartSerieItem.Label.TextBlock.Text = tmpInt.ToString("$#,##0,.00M") + " " + toMillion[1];
                    }

                    RadChartSerie.Items.Insert(RadChartSerie.Items.Count, RadChartSerieItem);
                }

            }             
        }
EN

回答 1

Stack Overflow用户

发布于 2012-10-19 19:45:27

如果在页面中看不到显示的chart image,则在Web.Config中有registered the correct version of the HTTP Handler的情况下使用check to see,或者在设计时通过智能标记添加HTTP Handler

它需要使用manually register the RadControls "HttpHandlers",或者使用IIS administration功能。manual registration的实现方式如下:(In web.config file)

代码语言:javascript
复制
<system.web>
…
<httpHandlers>
…  
    <add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI" validate="false" />
 …
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
 …
</handlers>
</system.webServer>

有关HTTP Handlers的手动注册或IIS7功能的更多详细信息,请单击HERE

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12973488

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档