频道栏目
首页 > 程序开发 > 软件开发 > 其他 > 正文
WPF使用TeeChart绘制三维图形 - CSDN博客
2019-05-11 22:26:09           
收藏   我要投稿

目的:使用TeeChart绘制三维图形。

效果图

\

项目中添加引用TeeChart.dll和TeeChart.WPF.dll;

xaml中添加引用

xmlns:my="clr-namespace:Steema.TeeChart.WPF;assembly=TeeChart.WPF"


关键代码

private Color[] myColors = { Color.FromArgb(0xFF, 0x21, 0x95, 0xF2), Color.FromArgb(0xFF, 0xF3, 0x43, 0x36), Color.FromArgb(0xFF, 0xFE, 0xC0, 0x07),
Color.FromArgb(0xFF, 0x60, 0x7D, 0x8A), Color.FromArgb(0xFF, 0x00, 0xBB, 0xD3), Color.FromArgb(0xFF, 0xE8, 0x1E, 0x63),
Color.FromArgb(0xFF, 0xFE, 0x57, 0x22), Color.FromArgb(0xFF, 0x3F, 0x51, 0xB4), Color.FromArgb(0xFF, 0xCC, 0xDB, 0x39), 
Color.FromArgb(0xFF, 0x4C, 0xAE, 0x50), Color.FromArgb(0xFF, 0x00, 0x95, 0x87)};

private void Button_Click_10(object sender, RoutedEventArgs e)
  {
tChart1.CurrentTheme = Steema.TeeChart.WPF.ThemeType.BlueSky; 
tChart1.Panel.Gradient.Visible = true;
tChart1.Panel.Brush.Transparency = 100;
tChart1.Panel.Bevel.Inner = BevelStyles.None;
tChart1.Panel.Bevel.Outer = BevelStyles.None;
tChart1.Aspect.View3D = true;
tChart1.Aspect.Chart3DPercent = 50;
tChart1.Aspect.Orthogonal = true;
tChart1.Header.Text = "title";
tChart1.Header.Font.Color = myColors[0];
tChart1.Header.Font.Size = 18;

tChart1.Legend.Visible = true;
tChart1.Legend.Title.Font.Size = 14;
tChart1.Legend.Alignment = Steema.TeeChart.WPF.LegendAlignments.Right;
tChart1.Legend.LegendStyle = Steema.TeeChart.WPF.LegendStyles.Auto;
tChart1.Legend.Symbol.Visible = true;
tChart1.Legend.Gradient.Visible = true;
tChart1.Legend.Brush.Transparency = 100;
tChart1.Legend.FontSeriesColor = true;
tChart1.Legend.DividingLines.Visible = false;

var dashStyle = new DashStyle(new double[] { 1, 5 }, 0);

tChart1.Axes.Left.Title.Text = "y";
tChart1.Axes.Left.Title.Font.Color = myColors[0];
tChart1.Axes.Left.Title.Font.Size = 16;
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.SetMinMax(0, 1);
tChart1.Axes.Left.Grid.Width = 1;
tChart1.Axes.Left.Grid.Style = dashStyle;
tChart1.Axes.Left.Grid.Color = myColors[0];
tChart1.Axes.Left.AxisPen.Color = myColors[0];
tChart1.Axes.Left.Labels.Font.Color = myColors[0];

tChart1.Axes.Bottom.Logarithmic = true;
tChart1.Axes.Bottom.Labels.Exponent = true;
tChart1.Axes.Bottom.Labels.ValueFormat = "00e-0";
tChart1.Axes.Bottom.Title.Text = "x";
tChart1.Axes.Bottom.Title.Font.Color = myColors[0];
tChart1.Axes.Bottom.Title.Font.Size = 16;
tChart1.Axes.Bottom.Grid.Width = 1;
tChart1.Axes.Bottom.Grid.Style = dashStyle;
tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.WPF.AxisLabelStyle.Value;
tChart1.Axes.Bottom.Labels.OnAxis = true;
tChart1.Axes.Bottom.Grid.Color = myColors[0];
tChart1.Axes.Bottom.Labels.Font.Color = myColors[0];
tChart1.Axes.Bottom.AxisPen.Color = myColors[0];

tChart1.Axes.Depth.Title.Text = "z";
tChart1.Axes.Depth.Title.Font.Color = myColors[0];
tChart1.Axes.Depth.Title.Font.Size = 16;
tChart1.Axes.Depth.Visible = true;
tChart1.Axes.Depth.Increment = 0.51;
tChart1.Axes.Depth.Grid.Width = 1;
tChart1.Axes.Depth.Grid.Style = dashStyle;
tChart1.Axes.Depth.Grid.Color = myColors[0];
tChart1.Axes.Depth.Labels.Font.Color = myColors[0];
tChart1.Axes.Depth.AxisPen.Color = myColors[0];

for (int num = 0; num < 11; num++)
{
 Steema.TeeChart.WPF.Styles.Points3D points3D = new Steema.TeeChart.WPF.Styles.Points3D();
 points3D.Pointer.Style = Steema.TeeChart.WPF.Styles.PointerStyles.Circle;
 points3D.Color = myColors[num];
 points3D.Pointer.Pen.Color = myColors[num];
 points3D.LinePen.Color = myColors[num];
 points3D.LinePen.Width = 2;
 points3D.Pointer.HorizSize = 2;
 points3D.Pointer.VertSize = 2;
 for (int i = 0; i < 100; i++)
 {
  points3D.Add(Math.Pow(10, 5.0 * i / 99 - 1), Math.Sin(i / 99.0 * Math.PI * (num + 1)), 0.51 * (num - 5));
 }
 tChart1.Series.Add(points3D);
 tChart1.Invalidate();
}
  }

?

点击复制链接 与好友分享!回本站首页
上一篇:SRM 591 DIV2 1000 - CSDN博客
下一篇:HTTP协议 - CSDN博客
相关文章
图文推荐
点击排行

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站