Skip to content

FunctionPlot: Optional X Limits #2156

@swharden

Description

@swharden

Some functions should only be plotted between a range of X values.

Functions which return null throw exceptions and make rendering slow.

Public fields should be added so users can restrict function rendering to a range.

public double XMin = double.NegativeInfinity;
public double XMax = double.PositiveInfinity;

Then in the render function those values should be checked and rendering should be restricted to that range.

Presently the render function calculates X/Y pairs for every point from the full visible range of the plot:

public void Render(PlotDimensions dims, Bitmap bmp, bool lowQuality = false)
{
List<double> xList = new List<double>();
List<double> yList = new List<double>();
PointCount = (int)dims.DataWidth;
for (int columnIndex = 0; columnIndex < dims.DataWidth; columnIndex++)
{
double x = columnIndex * dims.UnitsPerPxX + dims.XMin;

This feature may resolve the issue described by @phil100vol in #2138

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions