Skip to content

All graph types do not show the lowest value in the dataset #25

@bennyguk

Description

@bennyguk

When plotting data with any of the three chart types, the lowest value in the dataset is never drawn. This is perhaps most obviously demonstrated with a bar plot.

For example, If I create an array called "test" and add values from 1-10, like this:
image

You get a chart that looks like this:
image
You can see that the y-axis starts at 2 and not 1, and the first value is completely missing.

The result should look like this:
image

After doing some debugging, I believe the reason for this is because of two issues in Show-Graph.ps1.

On line 148 the below code never processes the last value in the set:
For($i=$NumOfRows;$i -gt 0;$i--)

Simply changing the -gt comparison operator to -ge ensures the for-loop processes all the data points:
For($i=$NumOfRows;$i -ge 0;$i--)

That alone does not resolve the issue though. The second section of code that needed changing is at line 221:
elseif($RangePercent -le 40 -and $RangePercent -ge 1)

A similar issue to the above, the code is not processed when $i is equal to 0:
$RangePercent = $i/$NumOfRows * 100
elseif($RangePercent -le 40 -and $RangePercent -ge 1)

Simply changing line 221 to elseif($RangePercent -le 40 -and $RangePercent -ge 0) allows the chart to be plotted correctly.

I hope this is useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions