diff --git a/implot.h b/implot.h index 127110e..1372cd9 100644 --- a/implot.h +++ b/implot.h @@ -345,55 +345,55 @@ IMPLOT_API void EndPlot(); // if you try plotting extremely large 64-bit integral types. Proceed with caution! // Plots a standard 2D line plot. -template IMPLOT_API void PlotLine(const char* label_id, const T* values, int count, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset = 0, int stride = sizeof(T)); - IMPLOT_API void PlotLineG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0); +template IMPLOT_API void PlotLine(const char* label_id, const T* values, int count, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T)); + IMPLOT_API void PlotLineG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0); // Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle. -template IMPLOT_API void PlotScatter(const char* label_id, const T* values, int count, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, int offset = 0, int stride = sizeof(T)); - IMPLOT_API void PlotScatterG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0); +template IMPLOT_API void PlotScatter(const char* label_id, const T* values, int count, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T)); + IMPLOT_API void PlotScatterG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0); // Plots a shaded (filled) region between two lines, or a line and a horizontal reference. -template IMPLOT_API void PlotShaded(const char* label_id, const T* values, int count, double y_ref = 0, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref = 0, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, int offset = 0, int stride = sizeof(T)); - IMPLOT_API void PlotShadedG(const char* label_id, ImPlotPoint (*getter1)(void* data, int idx), void* data1, ImPlotPoint (*getter2)(void* data, int idx), void* data2, int count, int offset = 0); +template IMPLOT_API void PlotShaded(const char* label_id, const T* values, int count, double y_ref=0, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, int offset=0, int stride=sizeof(T)); + IMPLOT_API void PlotShadedG(const char* label_id, ImPlotPoint (*getter1)(void* data, int idx), void* data1, ImPlotPoint (*getter2)(void* data, int idx), void* data2, int count, int offset=0); // Plots a vertical bar graph. #width and #shift are in X units. -template IMPLOT_API void PlotBars(const char* label_id, const T* values, int count, double width = 0.67, double shift = 0, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double width, int offset = 0, int stride = sizeof(T)); - IMPLOT_API void PlotBarsG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double width, int offset = 0); +template IMPLOT_API void PlotBars(const char* label_id, const T* values, int count, double width=0.67, double shift=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double width, int offset=0, int stride=sizeof(T)); + IMPLOT_API void PlotBarsG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double width, int offset=0); // Plots a horizontal bar graph. #height and #shift are in Y units. -template IMPLOT_API void PlotBarsH(const char* label_id, const T* values, int count, double height = 0.67, double shift = 0, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotBarsH(const char* label_id, const T* xs, const T* ys, int count, double height, int offset = 0, int stride = sizeof(T)); - IMPLOT_API void PlotBarsHG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double height, int offset = 0); +template IMPLOT_API void PlotBarsH(const char* label_id, const T* values, int count, double height=0.67, double shift=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotBarsH(const char* label_id, const T* xs, const T* ys, int count, double height, int offset=0, int stride=sizeof(T)); + IMPLOT_API void PlotBarsHG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double height, int offset=0); // Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot. -template IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, int offset = 0, int stride = sizeof(T)); +template IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, int offset=0, int stride=sizeof(T)); // Plots horizontal error bars. The label_id should be the same as the label_id of the associated line or bar plot. -template IMPLOT_API void PlotErrorBarsH(const char* label_id, const T* xs, const T* ys, const T* err, int count, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotErrorBarsH(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, int offset = 0, int stride = sizeof(T)); +template IMPLOT_API void PlotErrorBarsH(const char* label_id, const T* xs, const T* ys, const T* err, int count, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotErrorBarsH(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, int offset=0, int stride=sizeof(T)); /// Plots vertical stems. -template IMPLOT_API void PlotStems(const char* label_id, const T* values, int count, double y_ref = 0, int offset = 0, int stride = sizeof(T)); -template IMPLOT_API void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double y_ref = 0, int offset = 0, int stride = sizeof(T)); +template IMPLOT_API void PlotStems(const char* label_id, const T* values, int count, double y_ref=0, double xscale=1, double x0=0, int offset=0, int stride=sizeof(T)); +template IMPLOT_API void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double y_ref=0, int offset=0, int stride=sizeof(T)); // Plots a pie chart. If the sum of values > 1 or normalize is true, each value will be normalized. Center and radius are in plot units. #label_fmt can be set to NULL for no labels. -template IMPLOT_API void PlotPieChart(const char* const label_ids[], const T* values, int count, double x, double y, double radius, bool normalize = false, const char* label_fmt = "%.1f", double angle0 = 90); +template IMPLOT_API void PlotPieChart(const char* const label_ids[], const T* values, int count, double x, double y, double radius, bool normalize=false, const char* label_fmt="%.1f", double angle0=90); // Plots a 2D heatmap chart. Values are expected to be in row-major order. #label_fmt can be set to NULL for no labels. -template IMPLOT_API void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, double scale_min, double scale_max, const char* label_fmt = "%.1f", const ImPlotPoint& bounds_min = ImPlotPoint(0,0), const ImPlotPoint& bounds_max = ImPlotPoint(1,1)); +template IMPLOT_API void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, double scale_min, double scale_max, const char* label_fmt="%.1f", const ImPlotPoint& bounds_min=ImPlotPoint(0,0), const ImPlotPoint& bounds_max=ImPlotPoint(1,1)); // Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot. -template IMPLOT_API void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, int offset = 0, int stride = sizeof(T)); - IMPLOT_API void PlotDigitalG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0); +template IMPLOT_API void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T)); + IMPLOT_API void PlotDigitalG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0); // Plots a centered text label at point x,y with optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...). -IMPLOT_API void PlotText(const char* text, double x, double y, bool vertical = false, const ImVec2& pixel_offset = ImVec2(0,0)); +IMPLOT_API void PlotText(const char* text, double x, double y, bool vertical=false, const ImVec2& pixel_offset=ImVec2(0,0)); //----------------------------------------------------------------------------- // Plot Utils diff --git a/implot_demo.cpp b/implot_demo.cpp index 064451b..decccdc 100644 --- a/implot_demo.cpp +++ b/implot_demo.cpp @@ -529,15 +529,12 @@ void ShowDemoWindow(bool* p_open) { ImPlot::SetNextPlotLimitsX(t - history, t, ImGuiCond_Always); if (ImPlot::BeginPlot("##Scrolling", NULL, NULL, ImVec2(-1,150), 0, rt_axis, rt_axis | ImPlotAxisFlags_LockMin)) { ImPlot::PlotShaded("Data 1", &sdata1.Data[0].x, &sdata1.Data[0].y, sdata1.Data.size(), 0, sdata1.Offset, 2 * sizeof(float)); - ImPlot::PlotLine("Data 2", &sdata2.Data[0], sdata2.Data.size(), sdata2.Offset); + ImPlot::PlotLine("Data 2", &sdata2.Data[0].x, &sdata2.Data[0].y, sdata2.Data.size(), sdata2.Offset, 2*sizeof(float)); ImPlot::EndPlot(); } ImPlot::SetNextPlotLimitsX(0, history, ImGuiCond_Always); if (ImPlot::BeginPlot("##Rolling", NULL, NULL, ImVec2(-1,150), 0, rt_axis, rt_axis)) { - // two methods of plotting Data - // as ImVec2* (or ImPlot*): - ImPlot::PlotLine("Data 1", &rdata1.Data[0], rdata1.Data.size()); - // as float*, float* (or double*, double*) with stride of 2 * sizeof + ImPlot::PlotLine("Data 1", &rdata1.Data[0].x, &rdata1.Data[0].y, rdata1.Data.size(), 0, 2 * sizeof(float)); ImPlot::PlotLine("Data 2", &rdata2.Data[0].x, &rdata2.Data[0].y, rdata2.Data.size(), 0, 2 * sizeof(float)); ImPlot::EndPlot(); } @@ -1212,7 +1209,7 @@ void ShowDemoWindow(bool* p_open) { ImGui::SameLine(); ImGui::ColorEdit4("##Bear", &bearCol.x, ImGuiColorEditFlags_NoInputs); ImPlot::GetStyle().UseLocalTime = false; ImPlot::SetNextPlotLimits(1546300800, 1571961600, 1250, 1600); - if (ImPlot::BeginPlot("Candlestick Chart","Day","USD",ImVec2(-1,-1),0,ImPlotAxisFlags_Time)) { + if (ImPlot::BeginPlot("Candlestick Chart","Day","USD",ImVec2(-1,0),0,ImPlotAxisFlags_Time)) { MyImPlot::PlotCandlestick("GOOGL",dates, opens, closes, lows, highs, 218, tooltip, 0.25f, bullCol, bearCol); ImPlot::EndPlot(); } @@ -1542,8 +1539,10 @@ void ShowBenchmarkTool() { static char buffer[64]; if (ImPlot::BeginPlot("##Stats", "Items (1,000 pts each)", "Framerate (Hz)", ImVec2(-1,0), ImPlotFlags_NoChild)) { for (int run = 0; run < records.size(); ++run) { - sprintf(buffer, "B%d-%s%s", run + 1, names[records[run].Mode], records[run].AA ? "-AA" : ""); - ImPlot::PlotLine(buffer, records[run].Data.Data, records[run].Data.Size); + if (records[run].Data.Size > 1) { + sprintf(buffer, "B%d-%s%s", run + 1, names[records[run].Mode], records[run].AA ? "-AA" : ""); + ImPlot::PlotLine(buffer, &records[run].Data.Data[0].x, &records[run].Data.Data[0].y, records[run].Data.Size, 2*sizeof(double)); + } } ImPlot::EndPlot(); } diff --git a/implot_items.cpp b/implot_items.cpp index 6b9c3d3..3562b47 100644 --- a/implot_items.cpp +++ b/implot_items.cpp @@ -216,18 +216,17 @@ void EndItem() { // Interprets an array of Y points as ImPlotPoints where the X value is the index template struct GetterYs { - GetterYs(const T* ys, int count, int offset, int stride) { - Ys = ys; - Count = count; - Offset = count ? ImPosMod(offset, count) : 0; - Stride = stride; - } - const T* Ys; - int Count; - int Offset; - int Stride; + GetterYs(const T* ys, int count, double xscale, double x0, int offset, int stride) : + Ys(ys), Count(count), XScale(xscale), X0(x0), Offset(count ? ImPosMod(offset, count) : 0), Stride(stride) + { } + const T* const Ys; + const int Count; + const double XScale; + const double X0; + const int Offset; + const int Stride; inline ImPlotPoint operator()(int idx) const { - return ImPlotPoint((double)idx, (double)OffsetAndStride(Ys, idx, Count, Offset, Stride)); + return ImPlotPoint(X0 + XScale * idx, (double)OffsetAndStride(Ys, idx, Count, Offset, Stride)); } }; @@ -844,34 +843,21 @@ inline void PlotLineEx(const char* label_id, const Getter& getter) { } template -void PlotLine(const char* label_id, const T* values, int count, int offset, int stride) { - GetterYs getter(values,count,offset,stride); +void PlotLine(const char* label_id, const T* values, int count, double xscale, double x0, int offset, int stride) { + GetterYs getter(values,count,xscale,x0,offset,stride); PlotLineEx(label_id, getter); } -template IMPLOT_API void PlotLine(const char* label_id, const ImS8* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU8* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS16* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU16* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS32* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU32* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImS64* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const ImU64* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const float* values, int count, int offset, int stride); -template IMPLOT_API void PlotLine(const char* label_id, const double* values, int count, int offset, int stride); - -template <> -IMPLOT_API void PlotLine(const char* label_id, const ImVec2* data, int count, int offset, int) { - GetterImVec2 getter(data, count, offset); - return PlotLineEx(label_id, getter); -} - -template <> -IMPLOT_API void PlotLine(const char* label_id, const ImPlotPoint* data, int count, int offset, int) { - GetterImPlotPoint getter(data, count, offset); - return PlotLineEx(label_id, getter); -} - +template IMPLOT_API void PlotLine (const char* label_id, const ImS8* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine (const char* label_id, const ImU8* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const ImS16* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const ImU16* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const ImS32* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const ImU32* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const ImS64* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const ImU64* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const float* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotLine(const char* label_id, const double* values, int count, double xscale, double x0, int offset, int stride); template void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset, int stride) { @@ -928,33 +914,21 @@ inline void PlotScatterEx(const char* label_id, const Getter& getter) { } template -void PlotScatter(const char* label_id, const T* values, int count, int offset, int stride) { - GetterYs getter(values,count,offset,stride); +void PlotScatter(const char* label_id, const T* values, int count, double xscale, double x0, int offset, int stride) { + GetterYs getter(values,count,xscale,x0,offset,stride); PlotScatterEx(label_id, getter); } -template IMPLOT_API void PlotScatter(const char* label_id, const ImS8* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU8* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS16* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU16* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS32* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU32* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImS64* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const ImU64* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const float* values, int count, int offset, int stride); -template IMPLOT_API void PlotScatter(const char* label_id, const double* values, int count, int offset, int stride); - -template <> -IMPLOT_API void PlotScatter(const char* label_id, const ImVec2* data, int count, int offset, int) { - GetterImVec2 getter(data, count, offset); - return PlotScatterEx(label_id, getter); -} - -template <> -IMPLOT_API void PlotScatter(const char* label_id, const ImPlotPoint* data, int count, int offset, int) { - GetterImPlotPoint getter(data, count, offset); - return PlotScatterEx(label_id, getter); -} +template IMPLOT_API void PlotScatter(const char* label_id, const ImS8* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImU8* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImS16* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImU16* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImS32* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImU32* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImS64* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const ImU64* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const float* values, int count, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotScatter(const char* label_id, const double* values, int count, double xscale, double x0, int offset, int stride); template void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, int offset, int stride) { @@ -1010,22 +984,22 @@ inline void PlotShadedEx(const char* label_id, const Getter1& getter1, const Get } template -void PlotShaded(const char* label_id, const T* values, int count, double y_ref, int offset, int stride) { - GetterYs getter1(values,count,offset,stride); - GetterYRef getter2(y_ref, count); +void PlotShaded(const char* label_id, const T* values, int count, double y_ref, double xscale, double x0, int offset, int stride) { + GetterYs getter1(values,count,xscale,x0,offset,stride); + GetterYRef getter2(y_ref,count); PlotShadedEx(label_id, getter1, getter2); } -template IMPLOT_API void PlotShaded(const char* label_id, const ImS8* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU8* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS16* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU16* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS32* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU32* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImS64* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const ImU64* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const float* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotShaded(const char* label_id, const double* values, int count, double y_ref, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImS8* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImU8* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImS16* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImU16* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImS32* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImU32* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImS64* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const ImU64* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const float* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotShaded(const char* label_id, const double* values, int count, double y_ref, double xscale, double x0, int offset, int stride); template void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref, int offset, int stride) { @@ -1403,22 +1377,22 @@ inline void PlotStemsEx(const char* label_id, const GetterM& get_mark, const Get } template -void PlotStems(const char* label_id, const T* values, int count, double y_ref, int offset, int stride) { - GetterYs get_mark(values,count,offset,stride); +void PlotStems(const char* label_id, const T* values, int count, double y_ref, double xscale, double x0, int offset, int stride) { + GetterYs get_mark(values,count,xscale,x0,offset,stride); GetterYRef get_base(y_ref,count); PlotStemsEx(label_id, get_mark, get_base); } -template IMPLOT_API void PlotStems(const char* label_id, const ImS8* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU8* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS16* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU16* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS32* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU32* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImS64* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const ImU64* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const float* values, int count, double y_ref, int offset, int stride); -template IMPLOT_API void PlotStems(const char* label_id, const double* values, int count, double y_ref, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImS8* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImU8* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImS16* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImU16* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImS32* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImU32* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImS64* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const ImU64* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const float* values, int count, double y_ref, double xscale, double x0, int offset, int stride); +template IMPLOT_API void PlotStems(const char* label_id, const double* values, int count, double y_ref, double xscale, double x0, int offset, int stride); template void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double y_ref, int offset, int stride) {