mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349)
+ amended demo tweaks by ocornut
This commit is contained in:
		
				
					committed by
					
						 ocornut
						ocornut
					
				
			
			
				
	
			
			
			
						parent
						
							03ce17f0a5
						
					
				
				
					commit
					eb6c16d3dd
				
			| @@ -1561,16 +1561,17 @@ static void ShowDemoWindowWidgets() | ||||
|     } | ||||
|  | ||||
|     // Plot/Graph widgets are not very good. | ||||
|     // Consider writing your own, or using a third-party one, see: | ||||
|     // - ImPlot https://github.com/epezent/implot | ||||
|     // - others https://github.com/ocornut/imgui/wiki/Useful-Extensions | ||||
|     // Consider using a third-party library such as ImPlot: https://github.com/epezent/implot | ||||
|     // (see others https://github.com/ocornut/imgui/wiki/Useful-Extensions) | ||||
|     if (ImGui::TreeNode("Plots Widgets")) | ||||
|     { | ||||
|         static bool animate = true; | ||||
|         ImGui::Checkbox("Animate", &animate); | ||||
|  | ||||
|         // Plot as lines and plot as histogram | ||||
|         static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; | ||||
|         ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr)); | ||||
|         ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f)); | ||||
|  | ||||
|         // Fill an array of contiguous float values to plot | ||||
|         // Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float | ||||
| @@ -1600,7 +1601,6 @@ static void ShowDemoWindowWidgets() | ||||
|             sprintf(overlay, "avg %f", average); | ||||
|             ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f)); | ||||
|         } | ||||
|         ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f)); | ||||
|  | ||||
|         // Use functions to generate output | ||||
|         // FIXME: This is rather awkward because current plot API only pass in indices. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user