fix: Various pattern visualizer issues

Closes #1119
This commit is contained in:
WerWolv
2023-06-06 08:20:58 +02:00
parent a125408410
commit 44bbbb03af
2 changed files with 10 additions and 5 deletions

View File

@@ -51,14 +51,13 @@ namespace hex::plugin::builtin {
auto dataPattern = arguments[0].toPattern();
if (ImPlot::BeginPlot("##plot", ImVec2(400, 250), ImPlotFlags_NoChild | ImPlotFlags_CanvasOnly)) {
ImPlot::SetupAxes("X", "Y", ImPlotAxisFlags_AutoFit, ImPlotAxisFlags_AutoFit);
if (shouldReset) {
values.clear();
values = sampleData(patternToArray<float>(dataPattern), ImPlot::GetPlotSize().x * 4);
}
ImPlot::SetupAxes("X", "Y", ImPlotAxisFlags_AutoFit, ImPlotAxisFlags_AutoFit);
ImPlot::PlotLine("##line", values.data(), values.size());
ImPlot::EndPlot();
@@ -72,6 +71,7 @@ namespace hex::plugin::builtin {
auto yPattern = arguments[1].toPattern();
if (ImPlot::BeginPlot("##plot", ImVec2(400, 250), ImPlotFlags_NoChild | ImPlotFlags_CanvasOnly)) {
ImPlot::SetupAxes("X", "Y", ImPlotAxisFlags_AutoFit, ImPlotAxisFlags_AutoFit);
if (shouldReset) {
xValues.clear(); yValues.clear();
@@ -79,8 +79,6 @@ namespace hex::plugin::builtin {
yValues = sampleData(patternToArray<float>(yPattern), ImPlot::GetPlotSize().x * 4);
}
ImPlot::SetupAxes("X", "Y", ImPlotAxisFlags_AutoFit, ImPlotAxisFlags_AutoFit);
ImPlot::PlotScatter("##scatter", xValues.data(), yValues.data(), xValues.size());
ImPlot::EndPlot();