-
Notifications
You must be signed in to change notification settings - Fork 33
All graph types do not show the lowest value in the dataset #25
Description
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:

You get a chart that looks like this:

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:

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.