-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlotHistogram: Unexpected Values. #56
Comments
The final parameter is actually a stride in bytes, rather than elements. So if you change 1 to Additionally, the third parameter is actually supposed to be an "offset" for the data points. It turns out that the native code will wrap around if it reaches the end of the data (actually, it will trigger an assertion, but those are disabled in the version of cimgui being used). Since you're using the length of the array, it's just wrapping back around to the beginning. Aside from that, there is actually a genuine issue with the current wrapper method, because there's no way to specify the number of elements to plot yourself -- the full array size is always used. There should probably be an overload where you can pass in the length yourself, in addition to the "start index" (that's effectively the third parameter in the current version). If you wanted to use a stride of 2-floats, then you'd want to only draw half as many elements, otherwise it'll end up reading values past the end of the array. @se5a Let me know if that makes sense. |
size in bytes... ok that.. that would make more sense. |
@se5a I pushed a commit with a new void PlotHistogram(
string label,
float[] values,
int startIndex,
int count,
string overlayText = null,
float scaleMin = float.MaxValue,
float scaleMax = float.MaxValue,
Vector2 graphSize = default(Vector2),
int elementStride = 1) This one should be easier to understand, and has default parameter values that match the native API. |
My histograms are now with 100% less giberish. thanks! cool, that should help future confused people. |
I'm getting strange values for the histogram bars, with a really simple example:
The values where the bars are not showing (ie from tooltip text) are really strange values like:
-1.342e+08
even the third visable bar on the top histogram in the screenshot has a strange value of
1.074e+08
as you can see from the _testArray these values are not in the array at all.
in the stride2 example each of the odd numbered bars are the correct values of: 0, 0.1, 0.2, 0.3, 0.4, 0.5
every other value is negative.
The text was updated successfully, but these errors were encountered: