Graphical icon indicating copy to clipboard operation
Graphical copied to clipboard

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

Open bennyguk opened this issue 3 years ago • 2 comments

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.

bennyguk avatar Apr 20 '22 20:04 bennyguk

@bennyguk , this is very useful. I have encountered this in the past. I thought it related to not setting the reference valus for the x-axis.

I suggest put this forward as a push request for the project.

MMitsialis avatar Apr 27 '22 14:04 MMitsialis

Hi @MMitsialis No problem. I'll do that ASAP.

Thanks.

bennyguk avatar Apr 27 '22 14:04 bennyguk