Skip to content

Commit

Permalink
fix Signal GetLimits()
Browse files Browse the repository at this point in the history
Addresses the min/max render index problem raised in #621
  • Loading branch information
swharden committed Nov 22, 2020
1 parent 9fd468a commit 56112f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
9 changes: 6 additions & 3 deletions dev/changelog.md
@@ -1,14 +1,17 @@
# ScottPlot Changelog
# ScottPlot 4.0 Changelog

## ScottPlot 4.0.44 ⚠️ _in active development_
## ScottPlot 4.0.44
* Improved limits for fixed-size axis spans (#586) _Thanks @citizen3942 and @StendProg_
* Mouse drag/drop events now send useful event arguments (#593) _Thanks @charlescao460 and @StendProg_
* Fixed a bug that affected plots with extremely small (<1E-10) axis spans (#607) _Thanks @RFIsoft_
* Plot.SaveFig() now returns the full path to the file it created (#608)
* Fixed AxisAuto() bug affecting signal plots using min/max render indexes with a custom sample rate (#621) _Thanks @LB767_

## ScottPlot 4.0.43
* Improved appearance of semi-transparent legend items (#567)
* Improved tick labels for ticks smaller than 1E-5 (#568) _Thanks @ozgur640_
* Improved support for Avalonia 0.10 (#571) _Thanks @Benny121221 and @apkrymov_
* Improved positions for base16 ticks (#582, #581) _Thanks @Benny121221_
* Plot.SaveFig() now returns the full path to the file it created (#608)

## ScottPlot 4.0.42
* Improved DPI scaling support when using WinForms in .NET Core applications (#563) _Thanks @citizen3942_
Expand Down
15 changes: 5 additions & 10 deletions src/ScottPlot/plottables/PlottableSignalBase.cs
Expand Up @@ -191,17 +191,12 @@ public void updateData(T[] newData)
updateData(0, newData.Length, newData);
}

public override Config.AxisLimits2D GetLimits()
public override AxisLimits2D GetLimits()
{
double[] limits = new double[4];
limits[0] = minRenderIndex + xOffset;
limits[1] = _samplePeriod * maxRenderIndex + xOffset;
minmaxSearchStrategy.MinMaxRangeQuery(minRenderIndex, maxRenderIndex, out limits[2], out limits[3]);
limits[2] += yOffset;
limits[3] += yOffset;

// TODO: use features of 2d axis
return new Config.AxisLimits2D(limits);
double xMin = _samplePeriod * minRenderIndex;
double xMax = _samplePeriod * maxRenderIndex + xOffset;
minmaxSearchStrategy.MinMaxRangeQuery(minRenderIndex, maxRenderIndex, out double yMin, out double yMax);
return new AxisLimits2D(xMin + xOffset, xMax + xOffset, yMin + yOffset, yMax + yOffset);
}

private void RenderSingleLine(PlotDimensions dims, Graphics gfx, Pen penHD)
Expand Down

0 comments on commit 56112f2

Please sign in to comment.