teechart 上的 关于Custom axes的一段代码

private void LoadChart() {
tChart1.Dock = DockStyle.Fill;
Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis(false, false,tChart1.Chart);//新建坐标轴
Steema.TeeChart.Styles.Line line1 = new
Steema.TeeChart.Styles.Line(tChart1.Chart);
Steema.TeeChart.Styles.Line line2 = new
Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1.Axes.Custom.Add(axis1);//添加到custom坐标轴组中

line1.FillSampleValues(100);
line2.FillSampleValues(100);
line2.HorizAxis = Steema.TeeChart.Styles.HorizontalAxis.Both;
tChart1.Axes.Top.Visible = true;
tChart1.Axes.Top.Labels.Visible = false;
line1.CustomVertAxis = axis1;

axis1.MinimumOffset = 20;
tChart1.Axes.Left.MaximumOffset = 20;
tChart1.Axes.Custom[0].StartPosition = 0;
tChart1.Axes.Custom[0].EndPosition = 62.46;
tChart1.Axes.Left.StartPosition = 70.86;
tChart1.Axes.Left.EndPosition = 100;
}

private void AdjustGap() {
double chartTop = (double)tChart1.Axes.Top.Position;
double chartBottom = (double)tChart1.Axes.Bottom.Position;
double chartHeight = chartBottom - chartTop;
double interAxesGap = 10;
double interAxesGapPercent = (interAxesGap / chartHeight) * 100;

tChart1.Axes.Custom[0].StartPosition = 0;
tChart1.Axes.Custom[0].EndPosition = 66.66 - interAxesGapPercent;
tChart1.Axes.Left.StartPosition = 66.66 + interAxesGapPercent;
tChart1.Axes.Left.EndPosition = 100;
}

private void Form1_Resize(object sender, System.EventArgs e) {
AdjustGap();
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值