翻譯|使用教程|編輯:吳園園|2019-08-14 15:25:23.920|閱讀 365 次
概述:本教程介紹如何使用LightningChart SurfaceGridSeries3D創建具有線框和輪廓線的簡單3D?SurfaceGrid。?
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
點擊下載LightningChart Ultimate SDK最新試用版
LightningChart提供了兩種不同的方式將數據表示為3D表面 - SurfaceGridSeries3D和SurfaceMeshSeries3D。
在SurfaceGridSeries3D中,節點在X和Z維度上間隔相等,其中在SurfaceMeshSeries3D中,節點可以在3D空間中自由定位。
本教程介紹如何使用LightningChart SurfaceGridSeries3D創建具有線框和輪廓線的簡單3D SurfaceGrid。
SurfaceGrid允許將數據可視化為3D表面,并可用于表示,測量和檢查數據及其差異。
本教程中使用調色板著色來根據其值來表示不同顏色的數據。
建議您仔細閱讀我們的熱圖教程:其中介紹了調色板著色,然后繼續學習本教程。
在本教程中,我們預先定義了一些變量,以便于使用和清晰。
在Form或MainWindow類中定義以下變量,如下所示。
/// /// LightningChart component./// private LightningChartUltimate _chart = null;/// /// Reference to SurfaceGrid series in chart./// private SurfaceGridSeries3D _surfaceGrid = null;/// /// SurfaceGrid rows./// int _rows = 500;////// SurfaceGrid columns.///int _columns = 500;/// /// Minimum X-axis value./// private const int MinX = 0;/// /// Maximum X-axis value./// private const int MaxX = 100;/// /// Minimum Z-axis value./// private const int MinZ = 0;/// /// Maximum Z-axis value./// private const int MaxZ = 100;
1.將View3D定義為活動視圖并定義Y軸范圍。
// Set View3D as active view and set Y-axis range. _chart.ActiveView = ActiveView.View3D; _chart.View3D.YAxisPrimary3D.SetRange(-50, 100);
2.創建一個新的SurfaceGrid實例作為SurfaceGridSeries3D。
// Create a new SurfaceGrid instance as SurfaceGridSeries3D. _surfaceGrid = new SurfaceGridSeries3D(_chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
3.定義SurfaceGrid的設置。
// Set range, size and color saturation options for SurfaceGrid. _surfaceGrid.RangeMinX = MinX; _surfaceGrid.RangeMaxX = MaxX; _surfaceGrid.RangeMinZ = MinZ; _surfaceGrid.RangeMaxZ = MaxZ; _surfaceGrid.SizeX = _columns; _surfaceGrid.SizeZ = _rows;// Stronger colors. _surfaceGrid.C olorSaturation = 80;
4.創建ValueRangePalette并將其設置為SurfaceGrid的ContourPalette。
// Create ValueRangePalette for coloring SurfaceGrid's data.ValueRangePalette palette = CreatePalette(_surfaceGrid); _surfaceGrid.ContourPalette = palette;
5.為SurfaceGrid定義線框和輪廓線。
// Define WireFrameType and ContourLineType for SurfaceGrid. _surfaceGrid.WireframeType = SurfaceWireframeType3D.WireframePalettedByY; _surfaceGrid.ContourLineType = ContourLineType3D.ColorLineByY; _surfaceGrid.ContourLineWidth = 2;
6.生成數據。
// Generate data.public void GenerateData(int columns, int rows){ // Create variable for storing data. double data = 0; // Disable rendering before updating chart properties to improve performance // and to prevent unnecessary chart redrawing while changing multiple properties. _chart.BeginUpdate(); // Set data values and add them to SurfaceGrid. for (int i = 0; i < _columns; i++) { for (int j = 0; j < _rows; j++) { // Add values to the SurfaceGrid as SurfacePoints, points are distributed by using following function. data = 30.0 + 8 * Math.Cos(20 + 0.0001 * (double)(i * j)) + 60.0 * Math.Cos((double)(j - i) * 0.01); _surfaceGrid.Data[i, j].Y = data; } } // Notify chart about updated data. _surfaceGrid.InvalidateData(); // Call EndUpdate to enable rendering again. _chart.EndUpdate();}
以上就是如何建立3D SurfaceGrid圖表的教程,感興趣的朋友趕快下載體驗吧~
LightningChart Ultimate SDK現已加入在線訂購,點擊訂購立享優惠
有想要購買LightningChart Ultimate SDK正版授權的朋友可以。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: