我在mscharts中使用滚动条。我正在使用System.Web.UI.DataVisualization.Charting
库。
但是当我尝试添加滚动条时,otion丢失了,我收到以下错误:
错误23'System.Web.UI.DataVisualization.Charting.Axis'没有 包含'ScrollBar'的定义,没有扩展方法 'ScrollBar'接受第一个类型的参数 可以找到'System.Web.UI.DataVisualization.Charting.Axis'(是 你错过了使用指令或程序集引用?)
我的图表显示正常但是当X轴上的范围增加时,它会重叠数据点,所以我想要滚动条。任何帮助将不胜感激。
我正在编写以下代码来添加滚动条
//Chart1.ChartAreas["ChartArea1"].AxisX.ScrollBar.Enabled = true;
//Chart1.ChartAreas["ChartArea1"].AxisY.ScaleView.Zoomable.Enabled = true; tried several version of this.
//this is where I putting the data in chart
Chart1.DataBindCrossTable(dataforChart1.Rows, "Version", "DateofReport", "CountofInstalls",String.Empty);
foreach (Series cs in Chart1.Series)
{
// cs.LegendText = cs.Name;
Legend legend = new Legend(cs.Name);
Chart1.Legends.Add(legend);
Chart1.Legends[legend.Name].Docking = Docking.Bottom;
cs.ChartType = SeriesChartType.Line;
cs.BorderWidth = 2;
cs.XValueMember = "DateofReport";
cs.YValueMembers = "CountofInstalls";
cs.ToolTip = "#VALY #VALX";
}
// Chart1.Legend.Location
Chart1.DataBind();
正如您在图像中看到的那样,我获得了数据2/10的整行,并且它与图表的其余部分重叠。如果我减少X值的范围它会正常但我不想这样做,因为我可能需要整个范围。