1

我正在使用 CodePlex 免费的 Libero.FusionCharts 库作为更好的 Yahoo.FusionCharts。根据文档,我添加了一个 FChart 控件作为图表的占位符。

<%@ Register Assembly="Libero.FusionCharts" Namespace="Libero.FusionCharts.Control" TagPrefix="fcl" %>
<fcl:FChart runat="server" ID="chtProductSales" Width="530" Height="300" />

然后我在页面加载中执行以下操作:

    MSColumn3DLineDYChart oChart = new MSColumn3DLineDYChart();

    // Set properties
    oChart.Background.BgColor = "ffffff";
    oChart.Background.BgAlpha = 50;
    oChart.ChartTitles.Caption = "Response Time";

    // Set a template
    oChart.Template = new Libero.FusionCharts.Template.OfficeLightTemplate();

    ObjectDataSource ods = new ObjectDataSource();
    ods.SelectMethod = "GetCenterETAPTA";
    ods.TypeName = "reportingDB";

    DataView dv = (DataView)ods.Select();
    dv.Sort = "ChartSort ASC";

    DataTable dt = dv.ToTable();
    oChart.DataSource = dt;
    oChart.DataCategoryTextField = "HOC";
    oChart.DataSeriesTextField = "NOC";
    oChart.DataSeriesValueField = "Club";

    // Link the WebControl and the Chart
    // FChart chart = (FChart) Page.FindControl(this.chtProductSales.ClientID);

    chtProductSales.ShowChart(oChart);
    // chart.ShowChart(oChart);

在 chtProductSales 线上,它应该与 webcontrol 连接。编译器说:

错误 1 ​​当前上下文中不存在名称“chtProductSales”

但是,我可以做 Intellisense 并获得 this.chtProductSales!编译器有什么问题?我尝试了一个具有相同结果的 FindControl 调用。文档说明了我所需要的一切:

// Link the WebControl and the Chart
chtProductSalles.ShowChart(oChart);

他们发货的示例有效。到底是怎么回事?

4

1 回答 1

1

如果将此控件放在任何 ASP.NET 面板中,似乎该控件不起作用,因此请避免将其放在任何面板控件等中并尝试。

于 2013-06-15T16:49:31.853 回答