private void ChangeTableValue(float offset, bool fill = false) { if (table == null) { return; } Cursor.Current = Cursors.WaitCursor; //var length = Math.Abs(table.Max - table.Min); //var rawLength = Math.Abs(table.RawMax - table.RawMin); var step = Math.Max(Math.Abs(table.ConvertRawToValue(1) - table.ConvertRawToValue(0)), 0.01f); //Math.Max(length/rawLength, 0.01f); var fullTableUpdate = rtGrid.SelectedCells.Count > table.Count * 0.3; var values = table.GetFloatValues(); foreach (DataGridViewCell cell in rtGrid.SelectedCells) { var col = cell.ColumnIndex; var row = cell.RowIndex; var index = row * table.ColCount + col; var value = values[index]; if (fill) { value = offset; } else { value += step * offset; } value = (float)Math.Round(Math.Min(Math.Max(table.Min, value), table.Max), 3, MidpointRounding.AwayFromZero); if (fullTableUpdate) { values[index] = value; } else { table.SetFloatValue(col, row, value); } } if (fullTableUpdate) { table.SetFloatValues(values); } Cursor.Current = Cursors.Default; UpdateChart(); }
private void LoadChart() { var Y = table.GetFloatValues(); float[] X; float[] Z; var tableXsize = 16; var tableZsize = 16; if (veValue.Checked && !gbcValue.Checked || onlineManager.FirmwareManager.J7esFlags.IsKgbc32_16) { X = onlineManager.FirmwareManager.Rpm32_16RtPoints; tableXsize = 32; if (onlineManager.FirmwareManager.J7esFlags.IsKgbcPress32_32 || !gbcValue.Checked) { X = onlineManager.FirmwareManager.Rpm32_32RtPoints; Z = onlineManager.FirmwareManager.PressRt32Points; tableXsize = 32; tableZsize = 32; } else { Z = onlineManager.FirmwareManager.ThrRtPoints; } } else { X = onlineManager.FirmwareManager.Rpm16_16RtPoints; Z = onlineManager.FirmwareManager.ThrRtPoints; } PrepareChart(X.Length / tableXsize); Gigasoft.ProEssentials.Api.PEvsetW(rtChart.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.XData, X, X.Length); Gigasoft.ProEssentials.Api.PEvsetW(rtChart.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.YData, Y, Y.Length); Gigasoft.ProEssentials.Api.PEvsetW(rtChart.PeSpecial.HObject, Gigasoft.ProEssentials.DllProperties.ZData, Z, Z.Length); rtChart.PeFunction.ReinitializeResetImage(); rtChart.Refresh(); }