1
我使用.NET Winform版本teechart 4.1.2012.1032。放大缩小采样图
我修改了您提供的示例。 “Extended \ Reducing Number of Points \ DownSampling Additions” 但是,当我放大图表时,fastline的标记计数不是100,downSampling.DisplayedPointCount。 我该如何解决它?
private void InitializeChart()
{
this.cursorTool1 = new Steema.TeeChart.Tools.CursorTool();//
this.tChart1.Tools.Add(this.cursorTool1);//
this.cursorTool1.FollowMouse = true;//
this.cursorTool1.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;//
this.cursorTool1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(this.cursorTool1_Change);//
CreateArrays();
tChart1.Aspect.View3D = false;
tChart1.Zoom.Direction = ZoomDirections.Both;//.Horizontal;//
tChart1.Series.Add(points = new Steema.TeeChart.Styles.Points());
tChart1.Series.Add(fastLine = new Steema.TeeChart.Styles.FastLine());
downSampling = new Steema.TeeChart.Functions.DownSampling(tChart1.Chart);
points.Add(xValues, yValues);
points.Active = false;
downSampling.DisplayedPointCount = 100;
downSampling.Method = Steema.TeeChart.Functions.DownSamplingMethod.MinMaxFirstLast;// Null;
fastLine.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint;
fastLine.DataSource = points;
fastLine.Function = downSampling;
this.tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis(this.tChart1.Chart));//
this.tChart1[1].CustomVertAxis = this.tChart1.Axes.Custom[0];//
this.tChart1[0].CustomVertAxis = this.tChart1.Axes.Custom[0];//
this.fastLine.Marks.Visible = true;//
}
private void CreateArrays()
{
int length = 2600000;
xValues = new Nullable<double>[length];
yValues = new Nullable<double>[length];
Random rnd = new Random();
for (int i = 0; i < length; i++)
{
xValues[i] = i;
yValues[i] = i;
}
}
private void tChart1_Zoomed(object sender, EventArgs e)
{
tChart1[1].CheckDataSource(); //series 1 is the function series
}
我知道DisplayedPointCount的含义。如果我将DisplayedPointCount设置为100,则绘制100个点。但是当我放大时,我认为数值100必须在Axes.Bottom.Minimum和Maximum之间重绘。但结果没有。我该如何解决它?这个错误?请给我一个关于这种情况的示例代码(在缩减采样功能的情况下放大/缩小)谢谢。 – 2014-10-01 00:04:10
@DugSungKim恐怕我没有足够清楚地解释我自己。 DisplayedPointCount是将显示的最大点数,但并不意味着会达到此值。无论如何,我只是用解决方案更新了我的答案。 – 2014-10-01 10:07:29
谢谢你的回答。但是,如果points1.Active为false,则代码中显示的不正确。在我的情况下,Points1.Active必须是错误的,因为如果不是这样,那么将显示如此多的数据,并且图表性能不会太好。还有其他解决方案吗? – 2014-10-02 03:57:43