关键词:EasyChartX
1.简介
easyChartX使用Split显示时,默认会使用相同的X轴Title,本范例中实现了在Split显示时,分别把每条曲线对应的Title显示在正下方。
EasyChartX的SplitPlotArea属性,主要是配置和获取分区视图时各个绘图区的属性。
2.参考代码
1. using System;
2. using System;
3. using System.Windows.Forms;
4. using SeeSharpTools.JY.ArrayUtility;
5. using SeeSharpTools.JY.DSP.Fundamental;
6. using SeeSharpTools.JY.GUI;
7.
8. namespace GroupDisplay
9. {
10. public partial class Form1 : Form
11. {
12. public Form1()
13. {
14. InitializeComponent();
15. }
16.
17. private void eBtnStart_Click(object sender, EventArgs e)
18. {
19. double[,] wave = new double[1000, 5];
20. double[] temp = new double[1000];
21. for (int i = 0; i < 5; i++)
22. {
23. Generation.SineWave(ref temp, 1 + i, 0, 5);
24. ArrayManipulation.ReplaceArraySubset(temp, ref wave, i, ArrayManipulation.IndexType.column);
25.
26. }
27.
28. double[] multiple = new double[] { 0, 1, 0.5, 0.8, 0.2 };
29. double[,] MultipleWave = new double[wave.GetLength(0), wave.GetLength(1)];
30. MultipleData(ref MultipleWave, wave, multiple);
31.
32. int index = 0;
33. string[] names = new string[] { "CH1", "CH2", "CH3", "CH3", "CH4", "CH5", "CH6" };
34.
35. //遍历easyChartX所有分割区,给X轴附标题
36. foreach (EasyChartXPlotArea plotArea in this.easyChartX1.SplitPlotArea)
37. {
38. plotArea.AxisX.Title = names[index++];
39. plotArea.AxisX.TitleOrientation = SeeSharpTools.JY.GUI.EasyChartXAxis.AxisTextOrientation.Auto;
40. plotArea.AxisX.TitlePosition = SeeSharpTools.JY.GUI.EasyChartXAxis.AxisTextPosition.Center;
41. }
42. easyChartX1.Plot(MultipleWave, 0, 1, SeeSharpTools.JY.GUI.MajorOrder.Column);
43. }
44.
45. private void MultipleData(ref double[,] multipleData, double[,] rawData, double[] multiple)
46. {
47. double[] temp = new double[rawData.GetLength(0)];
48. for (int i = 0; i < rawData.GetLength(1); i++)
49. {
50. //数组拷贝
51. ArrayManipulation.GetArraySubset(rawData, i, ref temp, ArrayManipulation.IndexType.column);
52. ArrayCalculation.MultiplyScale(ref temp, multiple[i]);
53. ArrayManipulation.ReplaceArraySubset(temp, ref multipleData, i, ArrayManipulation.IndexType.column);
54. }
55. }
56. }
57. }
58. }
Copyright © 2016-2024 JYTEK All Rights Reserved.