mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 20:28:50 -05:00
templetize PlotLine, PlotScatter, PlotShaded, PlotBars, PlotBarsH
This commit is contained in:
parent
5c550385c6
commit
2eeceb3e22
50
implot.h
50
implot.h
|
@ -301,50 +301,34 @@ void EndPlot();
|
||||||
// Plot Items
|
// Plot Items
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Plots a standard 2D line plot.
|
// Supported Types for T*
|
||||||
// void PlotLine(const char* label_id, const float* values, int count, int offset = 0, int stride = sizeof(float));
|
// float, double, ImS8, ImU8, ImS16, ImU16, ImS32, ImU32, ImS64, ImU64
|
||||||
// void PlotLine(const char* label_id, const double* values, int count, int offset = 0, int stride = sizeof(double));
|
|
||||||
// void PlotLine(const char* label_id, const float* xs, const float* ys, int count, int offset = 0, int stride = sizeof(float));
|
|
||||||
// void PlotLine(const char* label_id, const double* xs, const double* ys, int count, int offset = 0, int stride = sizeof(double));
|
|
||||||
// void PlotLine(const char* label_id, const ImVec2* data, int count, int offset = 0);
|
|
||||||
// void PlotLine(const char* label_id, const ImPlotPoint* data, int count, int offset = 0);
|
|
||||||
|
|
||||||
|
// Plots a standard 2D line plot.
|
||||||
template <typename T> void PlotLine(const char* label_id, const T* values, int count, int offset = 0, int stride = sizeof(T));
|
template <typename T> void PlotLine(const char* label_id, const T* values, int count, int offset = 0, int stride = sizeof(T));
|
||||||
template <typename T> void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset = 0, int stride = sizeof(T));
|
template <typename T> void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotLineG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0);
|
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.
|
// Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle.
|
||||||
void PlotScatter(const char* label_id, const float* values, int count, int offset = 0, int stride = sizeof(float));
|
template <typename T> void PlotScatter(const char* label_id, const T* values, int count, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotScatter(const char* label_id, const double* values, int count, int offset = 0, int stride = sizeof(double));
|
template <typename T> void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotScatter(const char* label_id, const float* xs, const float* ys, int count, int offset = 0, int stride = sizeof(float));
|
void PlotScatterG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset = 0);
|
||||||
void PlotScatter(const char* label_id, const double* xs, const double* ys, int count, int offset = 0, int stride = sizeof(double));
|
|
||||||
void PlotScatter(const char* label_id, const ImVec2* data, int count, int offset = 0);
|
|
||||||
void PlotScatter(const char* label_id, const ImPlotPoint* data, int count, int offset = 0);
|
|
||||||
void PlotScatter(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.
|
// Plots a shaded (filled) region between two lines, or a line and a horizontal reference.
|
||||||
void PlotShaded(const char* label_id, const float* values, int count, float y_ref = 0, int offset = 0, int stride = sizeof(float));
|
template <typename T> void PlotShaded(const char* label_id, const T* values, int count, double y_ref = 0, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotShaded(const char* label_id, const double* values, int count, double y_ref = 0, int offset = 0, int stride = sizeof(double));
|
template <typename T> 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));
|
||||||
void PlotShaded(const char* label_id, const float* xs, const float* ys, int count, float y_ref = 0, int offset = 0, int stride = sizeof(float));
|
template <typename T> void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotShaded(const char* label_id, const double* xs, const double* ys, int count, double y_ref = 0, int offset = 0, int stride = sizeof(double));
|
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);
|
||||||
void PlotShaded(const char* label_id, const float* xs, const float* ys1, const float* ys2, int count, int offset = 0, int stride = sizeof(float));
|
|
||||||
void PlotShaded(const char* label_id, const double* xs, const double* ys1, const double* ys2, int count, int offset = 0, int stride = sizeof(double));
|
|
||||||
void PlotShaded(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.
|
// Plots a vertical bar graph. #width and #shift are in X units.
|
||||||
void PlotBars(const char* label_id, const float* values, int count, float width = 0.67f, float shift = 0, int offset = 0, int stride = sizeof(float));
|
template <typename T> 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));
|
||||||
void PlotBars(const char* label_id, const double* values, int count, double width = 0.67f, double shift = 0, int offset = 0, int stride = sizeof(double));
|
template <typename T> void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double width, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotBars(const char* label_id, const float* xs, const float* ys, int count, float width, int offset = 0, int stride = sizeof(float));
|
void PlotBarsG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double width, int offset = 0);
|
||||||
void PlotBars(const char* label_id, const double* xs, const double* ys, int count, double width, int offset = 0, int stride = sizeof(double));
|
|
||||||
void PlotBars(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.
|
// Plots a horizontal bar graph. #height and #shift are in Y units.
|
||||||
void PlotBarsH(const char* label_id, const float* values, int count, float height = 0.67f, float shift = 0, int offset = 0, int stride = sizeof(float));
|
template <typename T> 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));
|
||||||
void PlotBarsH(const char* label_id, const double* values, int count, double height = 0.67f, double shift = 0, int offset = 0, int stride = sizeof(double));
|
template <typename T> void PlotBarsH(const char* label_id, const T* xs, const T* ys, int count, double height, int offset = 0, int stride = sizeof(T));
|
||||||
void PlotBarsH(const char* label_id, const float* xs, const float* ys, int count, float height, int offset = 0, int stride = sizeof(float));
|
void PlotBarsHG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, double height, int offset = 0);
|
||||||
void PlotBarsH(const char* label_id, const double* xs, const double* ys, int count, double height, int offset = 0, int stride = sizeof(double));
|
|
||||||
void PlotBarsH(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.
|
// Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
|
||||||
void PlotErrorBars(const char* label_id, const float* xs, const float* ys, const float* err, int count, int offset = 0, int stride = sizeof(float));
|
void PlotErrorBars(const char* label_id, const float* xs, const float* ys, const float* err, int count, int offset = 0, int stride = sizeof(float));
|
||||||
|
|
|
@ -1069,7 +1069,7 @@ void ShowDemoWindow(bool* p_open) {
|
||||||
ImPlot::PlotLineG("Waves", MyImPlot::SineWave, &data1, 1000);
|
ImPlot::PlotLineG("Waves", MyImPlot::SineWave, &data1, 1000);
|
||||||
ImPlot::PlotLineG("Waves", MyImPlot::SawWave, &data2, 1000);
|
ImPlot::PlotLineG("Waves", MyImPlot::SawWave, &data2, 1000);
|
||||||
ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, 0.25f);
|
ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, 0.25f);
|
||||||
ImPlot::PlotShaded("Waves", MyImPlot::SineWave, &data1, MyImPlot::SawWave, &data2, 1000);
|
ImPlot::PlotShadedG("Waves", MyImPlot::SineWave, &data1, MyImPlot::SawWave, &data2, 1000);
|
||||||
ImPlot::PopStyleVar();
|
ImPlot::PopStyleVar();
|
||||||
// you can also pass C++ lambdas:
|
// you can also pass C++ lambdas:
|
||||||
// auto lamda = [](void* data, int idx) { ... return ImPlotPoint(x,y); };
|
// auto lamda = [](void* data, int idx) { ... return ImPlotPoint(x,y); };
|
||||||
|
|
245
implot_items.cpp
245
implot_items.cpp
|
@ -257,9 +257,9 @@ struct GetterYRef {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Interprets an array of X points as ImPlotPoints where the Y value is a constant reference value
|
// Interprets an array of X points as ImPlotPoints where the Y value is a constant reference value
|
||||||
template <typename T>
|
template <typename T, typename Y>
|
||||||
struct GetterXsYRef {
|
struct GetterXsYRef {
|
||||||
GetterXsYRef(const T* xs, T y_ref, int count, int offset, int stride) {
|
GetterXsYRef(const T* xs, Y y_ref, int count, int offset, int stride) {
|
||||||
Xs = xs;
|
Xs = xs;
|
||||||
YRef = y_ref;
|
YRef = y_ref;
|
||||||
Count = count;
|
Count = count;
|
||||||
|
@ -267,7 +267,7 @@ struct GetterXsYRef {
|
||||||
Stride = stride;
|
Stride = stride;
|
||||||
}
|
}
|
||||||
const T* Xs;
|
const T* Xs;
|
||||||
T YRef;
|
Y YRef;
|
||||||
int Count;
|
int Count;
|
||||||
int Offset;
|
int Offset;
|
||||||
int Stride;
|
int Stride;
|
||||||
|
@ -328,15 +328,15 @@ struct GetterFuncPtrImPlotPoint {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct GetterBarV {
|
struct GetterBarV {
|
||||||
const T* Ys; T XShift; int Count; int Offset; int Stride;
|
const T* Ys; double XShift; int Count; int Offset; int Stride;
|
||||||
GetterBarV(const T* ys, T xshift, int count, int offset, int stride) { Ys = ys; XShift = xshift; Count = count; Offset = offset; Stride = stride; }
|
GetterBarV(const T* ys, double xshift, int count, int offset, int stride) { Ys = ys; XShift = xshift; Count = count; Offset = offset; Stride = stride; }
|
||||||
inline ImPlotPoint operator()(int idx) { return ImPlotPoint((double)idx + (double)XShift, (double)OffsetAndStride(Ys, idx, Count, Offset, Stride)); }
|
inline ImPlotPoint operator()(int idx) { return ImPlotPoint((double)idx + (double)XShift, (double)OffsetAndStride(Ys, idx, Count, Offset, Stride)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct GetterBarH {
|
struct GetterBarH {
|
||||||
const T* Xs; T YShift; int Count; int Offset; int Stride;
|
const T* Xs; double YShift; int Count; int Offset; int Stride;
|
||||||
GetterBarH(const T* xs, T yshift, int count, int offset, int stride) { Xs = xs; YShift = yshift; Count = count; Offset = offset; Stride = stride; }
|
GetterBarH(const T* xs, double yshift, int count, int offset, int stride) { Xs = xs; YShift = yshift; Count = count; Offset = offset; Stride = stride; }
|
||||||
inline ImPlotPoint operator()(int idx) { return ImPlotPoint((double)OffsetAndStride(Xs, idx, Count, Offset, Stride), (double)idx + (double)YShift); }
|
inline ImPlotPoint operator()(int idx) { return ImPlotPoint((double)OffsetAndStride(Xs, idx, Count, Offset, Stride), (double)idx + (double)YShift); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -359,7 +359,6 @@ struct GetterError {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Transforms convert points in plot space (i.e. ImPlotPoint) to pixel space (i.e. ImVec2)
|
// Transforms convert points in plot space (i.e. ImPlotPoint) to pixel space (i.e. ImVec2)
|
||||||
// TODO: Cache transformation variables
|
|
||||||
|
|
||||||
// Transforms points for linear x and linear y space
|
// Transforms points for linear x and linear y space
|
||||||
struct TransformerLinLin {
|
struct TransformerLinLin {
|
||||||
|
@ -371,7 +370,6 @@ struct TransformerLinLin {
|
||||||
return ImVec2( (float)(gp.PixelRange[YAxis].Min.x + gp.Mx * (x - gp.CurrentPlot->XAxis.Range.Min)),
|
return ImVec2( (float)(gp.PixelRange[YAxis].Min.x + gp.Mx * (x - gp.CurrentPlot->XAxis.Range.Min)),
|
||||||
(float)(gp.PixelRange[YAxis].Min.y + gp.My[YAxis] * (y - gp.CurrentPlot->YAxis[YAxis].Range.Min)) );
|
(float)(gp.PixelRange[YAxis].Min.y + gp.My[YAxis] * (y - gp.CurrentPlot->YAxis[YAxis].Range.Min)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int YAxis;
|
int YAxis;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -420,7 +418,6 @@ struct TransformerLogLog {
|
||||||
return ImVec2( (float)(gp.PixelRange[YAxis].Min.x + gp.Mx * (x - gp.CurrentPlot->XAxis.Range.Min)),
|
return ImVec2( (float)(gp.PixelRange[YAxis].Min.x + gp.Mx * (x - gp.CurrentPlot->XAxis.Range.Min)),
|
||||||
(float)(gp.PixelRange[YAxis].Min.y + gp.My[YAxis] * (y - gp.CurrentPlot->YAxis[YAxis].Range.Min)) );
|
(float)(gp.PixelRange[YAxis].Min.y + gp.My[YAxis] * (y - gp.CurrentPlot->YAxis[YAxis].Range.Min)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int YAxis;
|
int YAxis;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -813,7 +810,7 @@ inline void RenderMarkers(Getter getter, Transformer transformer, ImDrawList& Dr
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// PLOT LINES / MARKERS
|
// PLOT LINES
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename Getter>
|
template <typename Getter>
|
||||||
|
@ -881,7 +878,6 @@ void PlotLine<ImPlotPoint>(const char* label_id, const ImPlotPoint* data, int co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset, int stride) {
|
void PlotLine(const char* label_id, const T* xs, const T* ys, int count, int offset, int stride) {
|
||||||
GetterXsYs<T> getter(xs,ys,count,offset,stride);
|
GetterXsYs<T> getter(xs,ys,count,offset,stride);
|
||||||
|
@ -936,40 +932,55 @@ inline void PlotScatterEx(const char* label_id, Getter getter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// float
|
template <typename T>
|
||||||
void PlotScatter(const char* label_id, const float* values, int count, int offset, int stride) {
|
void PlotScatter(const char* label_id, const T* values, int count, int offset, int stride) {
|
||||||
GetterYs<float> getter(values,count,offset,stride);
|
GetterYs<T> getter(values,count,offset,stride);
|
||||||
PlotScatterEx(label_id, getter);
|
PlotScatterEx(label_id, getter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotScatter(const char* label_id, const float* xs, const float* ys, int count, int offset, int stride) {
|
template void PlotScatter<ImS8>(const char* label_id, const ImS8* values, int count, int offset, int stride);
|
||||||
GetterXsYs<float> getter(xs,ys,count,offset,stride);
|
template void PlotScatter<ImU8>(const char* label_id, const ImU8* values, int count, int offset, int stride);
|
||||||
return PlotScatterEx(label_id, getter);
|
template void PlotScatter<ImS16>(const char* label_id, const ImS16* values, int count, int offset, int stride);
|
||||||
}
|
template void PlotScatter<ImU16>(const char* label_id, const ImU16* values, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImS32>(const char* label_id, const ImS32* values, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImU32>(const char* label_id, const ImU32* values, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImS64>(const char* label_id, const ImS64* values, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImU64>(const char* label_id, const ImU64* values, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<float>(const char* label_id, const float* values, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<double>(const char* label_id, const double* values, int count, int offset, int stride);
|
||||||
|
|
||||||
void PlotScatter(const char* label_id, const ImVec2* data, int count, int offset) {
|
template <>
|
||||||
|
void PlotScatter<ImVec2>(const char* label_id, const ImVec2* data, int count, int offset, int) {
|
||||||
GetterImVec2 getter(data, count, offset);
|
GetterImVec2 getter(data, count, offset);
|
||||||
return PlotScatterEx(label_id, getter);
|
return PlotScatterEx(label_id, getter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// double
|
template <>
|
||||||
void PlotScatter(const char* label_id, const double* values, int count, int offset, int stride) {
|
void PlotScatter<ImPlotPoint>(const char* label_id, const ImPlotPoint* data, int count, int offset, int) {
|
||||||
GetterYs<double> getter(values,count,offset,stride);
|
|
||||||
PlotScatterEx(label_id, getter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlotScatter(const char* label_id, const double* xs, const double* ys, int count, int offset, int stride) {
|
|
||||||
GetterXsYs<double> getter(xs,ys,count,offset,stride);
|
|
||||||
return PlotScatterEx(label_id, getter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlotScatter(const char* label_id, const ImPlotPoint* data, int count, int offset) {
|
|
||||||
GetterImPlotPoint getter(data, count, offset);
|
GetterImPlotPoint getter(data, count, offset);
|
||||||
return PlotScatterEx(label_id, getter);
|
return PlotScatterEx(label_id, getter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, int offset, int stride) {
|
||||||
|
GetterXsYs<T> getter(xs,ys,count,offset,stride);
|
||||||
|
return PlotScatterEx(label_id, getter);
|
||||||
|
}
|
||||||
|
|
||||||
|
template void PlotScatter<ImS8>(const char* label_id, const ImS8* xs, const ImS8* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImU8>(const char* label_id, const ImU8* xs, const ImU8* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImS16>(const char* label_id, const ImS16* xs, const ImS16* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImU16>(const char* label_id, const ImU16* xs, const ImU16* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImS32>(const char* label_id, const ImS32* xs, const ImS32* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImU32>(const char* label_id, const ImU32* xs, const ImU32* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImS64>(const char* label_id, const ImS64* xs, const ImS64* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<ImU64>(const char* label_id, const ImU64* xs, const ImU64* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<float>(const char* label_id, const float* xs, const float* ys, int count, int offset, int stride);
|
||||||
|
template void PlotScatter<double>(const char* label_id, const double* xs, const double* ys, int count, int offset, int stride);
|
||||||
|
|
||||||
// custom
|
// custom
|
||||||
void PlotScatter(const char* label_id, ImPlotPoint (*getter_func)(void* data, int idx), void* data, int count, int offset) {
|
void PlotScatterG(const char* label_id, ImPlotPoint (*getter_func)(void* data, int idx), void* data, int count, int offset) {
|
||||||
GetterFuncPtrImPlotPoint getter(getter_func,data, count, offset);
|
GetterFuncPtrImPlotPoint getter(getter_func,data, count, offset);
|
||||||
return PlotScatterEx(label_id, getter);
|
return PlotScatterEx(label_id, getter);
|
||||||
}
|
}
|
||||||
|
@ -1004,52 +1015,69 @@ inline void PlotShadedEx(const char* label_id, Getter1 getter1, Getter2 getter2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// float
|
template <typename T>
|
||||||
void PlotShaded(const char* label_id, const float* values, int count, float y_ref, int offset, int stride) {
|
void PlotShaded(const char* label_id, const T* values, int count, double y_ref, int offset, int stride) {
|
||||||
GetterYs<float> getter1(values,count,offset,stride);
|
GetterYs<T> getter1(values,count,offset,stride);
|
||||||
GetterYRef<float> getter2(y_ref, count);
|
|
||||||
PlotShadedEx(label_id, getter1, getter2);}
|
|
||||||
|
|
||||||
void PlotShaded(const char* label_id, const float* xs, const float* ys1, const float* ys2, int count, int offset, int stride) {
|
|
||||||
GetterXsYs<float> getter1(xs, ys1, count, offset, stride);
|
|
||||||
GetterXsYs<float> getter2(xs, ys2, count, offset, stride);
|
|
||||||
PlotShadedEx(label_id, getter1, getter2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlotShaded(const char* label_id, const float* xs, const float* ys, int count, float y_ref, int offset, int stride) {
|
|
||||||
GetterXsYs<float> getter1(xs, ys, count, offset, stride);
|
|
||||||
GetterXsYRef<float> getter2(xs, y_ref, count, offset, stride);
|
|
||||||
PlotShadedEx(label_id, getter1, getter2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// double
|
|
||||||
void PlotShaded(const char* label_id, const double* values, int count, double y_ref, int offset, int stride) {
|
|
||||||
GetterYs<double> getter1(values,count,offset,stride);
|
|
||||||
GetterYRef<double> getter2(y_ref, count);
|
GetterYRef<double> getter2(y_ref, count);
|
||||||
PlotShadedEx(label_id, getter1, getter2);
|
PlotShadedEx(label_id, getter1, getter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotShaded(const char* label_id, const double* xs, const double* ys1, const double* ys2, int count, int offset, int stride) {
|
template void PlotShaded<ImS8>(const char* label_id, const ImS8* values, int count, double y_ref, int offset, int stride);
|
||||||
GetterXsYs<double> getter1(xs, ys1, count, offset, stride);
|
template void PlotShaded<ImU8>(const char* label_id, const ImU8* values, int count, double y_ref, int offset, int stride);
|
||||||
GetterXsYs<double> getter2(xs, ys2, count, offset, stride);
|
template void PlotShaded<ImS16>(const char* label_id, const ImS16* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU16>(const char* label_id, const ImU16* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS32>(const char* label_id, const ImS32* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU32>(const char* label_id, const ImU32* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS64>(const char* label_id, const ImS64* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU64>(const char* label_id, const ImU64* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<float>(const char* label_id, const float* values, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<double>(const char* label_id, const double* values, int count, double y_ref, int offset, int stride);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double y_ref, int offset, int stride) {
|
||||||
|
GetterXsYs<T> getter1(xs, ys, count, offset, stride);
|
||||||
|
GetterXsYRef<T,double> getter2(xs, y_ref, count, offset, stride);
|
||||||
PlotShadedEx(label_id, getter1, getter2);
|
PlotShadedEx(label_id, getter1, getter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotShaded(const char* label_id, const double* xs, const double* ys, int count, double y_ref, int offset, int stride) {
|
template void PlotShaded<ImS8>(const char* label_id, const ImS8* xs, const ImS8* ys, int count, double y_ref, int offset, int stride);
|
||||||
GetterXsYs<double> getter1(xs, ys, count, offset, stride);
|
template void PlotShaded<ImU8>(const char* label_id, const ImU8* xs, const ImU8* ys, int count, double y_ref, int offset, int stride);
|
||||||
GetterXsYRef<double> getter2(xs, y_ref, count, offset, stride);
|
template void PlotShaded<ImS16>(const char* label_id, const ImS16* xs, const ImS16* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU16>(const char* label_id, const ImU16* xs, const ImU16* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS32>(const char* label_id, const ImS32* xs, const ImS32* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU32>(const char* label_id, const ImU32* xs, const ImU32* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS64>(const char* label_id, const ImS64* xs, const ImS64* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU64>(const char* label_id, const ImU64* xs, const ImU64* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<float>(const char* label_id, const float* xs, const float* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
template void PlotShaded<double>(const char* label_id, const double* xs, const double* ys, int count, double y_ref, int offset, int stride);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, int offset, int stride) {
|
||||||
|
GetterXsYs<T> getter1(xs, ys1, count, offset, stride);
|
||||||
|
GetterXsYs<T> getter2(xs, ys2, count, offset, stride);
|
||||||
PlotShadedEx(label_id, getter1, getter2);
|
PlotShadedEx(label_id, getter1, getter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template void PlotShaded<ImS8>(const char* label_id, const ImS8* xs, const ImS8* ys1, const ImS8* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU8>(const char* label_id, const ImU8* xs, const ImU8* ys1, const ImU8* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS16>(const char* label_id, const ImS16* xs, const ImS16* ys1, const ImS16* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU16>(const char* label_id, const ImU16* xs, const ImU16* ys1, const ImU16* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS32>(const char* label_id, const ImS32* xs, const ImS32* ys1, const ImS32* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU32>(const char* label_id, const ImU32* xs, const ImU32* ys1, const ImU32* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImS64>(const char* label_id, const ImS64* xs, const ImS64* ys1, const ImS64* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<ImU64>(const char* label_id, const ImU64* xs, const ImU64* ys1, const ImU64* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<float>(const char* label_id, const float* xs, const float* ys1, const float* ys2, int count, int offset, int stride);
|
||||||
|
template void PlotShaded<double>(const char* label_id, const double* xs, const double* ys1, const double* ys2, int count, int offset, int stride);
|
||||||
|
|
||||||
// custom
|
// custom
|
||||||
void PlotShaded(const char* label_id, ImPlotPoint (*g1)(void* data, int idx), void* data1, ImPlotPoint (*g2)(void* data, int idx), void* data2, int count, int offset) {
|
void PlotShadedG(const char* label_id, ImPlotPoint (*g1)(void* data, int idx), void* data1, ImPlotPoint (*g2)(void* data, int idx), void* data2, int count, int offset) {
|
||||||
GetterFuncPtrImPlotPoint getter1(g1, data1, count, offset);
|
GetterFuncPtrImPlotPoint getter1(g1, data1, count, offset);
|
||||||
GetterFuncPtrImPlotPoint getter2(g2, data2, count, offset);
|
GetterFuncPtrImPlotPoint getter2(g2, data2, count, offset);
|
||||||
PlotShadedEx(label_id, getter1, getter2);
|
PlotShadedEx(label_id, getter1, getter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// PLOT BAR V
|
// PLOT BAR
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// TODO: Migrate to RenderPrimitives
|
// TODO: Migrate to RenderPrimitives
|
||||||
|
@ -1087,30 +1115,42 @@ void PlotBarsEx(const char* label_id, Getter getter, TWidth width) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// float
|
template <typename T>
|
||||||
void PlotBars(const char* label_id, const float* values, int count, float width, float shift, int offset, int stride) {
|
void PlotBars(const char* label_id, const T* values, int count, double width, double shift, int offset, int stride) {
|
||||||
GetterBarV<float> getter(values,shift,count,offset,stride);
|
GetterBarV<T> getter(values,shift,count,offset,stride);
|
||||||
PlotBarsEx(label_id, getter, width);
|
PlotBarsEx(label_id, getter, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotBars(const char* label_id, const float* xs, const float* ys, int count, float width, int offset, int stride) {
|
template void PlotBars<ImS8>(const char* label_id, const ImS8* values, int count, double width, double shift, int offset, int stride);
|
||||||
GetterXsYs<float> getter(xs,ys,count,offset,stride);
|
template void PlotBars<ImU8>(const char* label_id, const ImU8* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<ImS16>(const char* label_id, const ImS16* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<ImU16>(const char* label_id, const ImU16* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<ImS32>(const char* label_id, const ImS32* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<ImU32>(const char* label_id, const ImU32* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<ImS64>(const char* label_id, const ImS64* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<ImU64>(const char* label_id, const ImU64* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<float>(const char* label_id, const float* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
template void PlotBars<double>(const char* label_id, const double* values, int count, double width, double shift, int offset, int stride);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double width, int offset, int stride) {
|
||||||
|
GetterXsYs<T> getter(xs,ys,count,offset,stride);
|
||||||
PlotBarsEx(label_id, getter, width);
|
PlotBarsEx(label_id, getter, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// double
|
template void PlotBars<ImS8>(const char* label_id, const ImS8* xs, const ImS8* ys, int count, double width, int offset, int stride);
|
||||||
void PlotBars(const char* label_id, const double* values, int count, double width, double shift, int offset, int stride) {
|
template void PlotBars<ImU8>(const char* label_id, const ImU8* xs, const ImU8* ys, int count, double width, int offset, int stride);
|
||||||
GetterBarV<double> getter(values,shift,count,offset,stride);
|
template void PlotBars<ImS16>(const char* label_id, const ImS16* xs, const ImS16* ys, int count, double width, int offset, int stride);
|
||||||
PlotBarsEx(label_id, getter, width);
|
template void PlotBars<ImU16>(const char* label_id, const ImU16* xs, const ImU16* ys, int count, double width, int offset, int stride);
|
||||||
}
|
template void PlotBars<ImS32>(const char* label_id, const ImS32* xs, const ImS32* ys, int count, double width, int offset, int stride);
|
||||||
|
template void PlotBars<ImU32>(const char* label_id, const ImU32* xs, const ImU32* ys, int count, double width, int offset, int stride);
|
||||||
void PlotBars(const char* label_id, const double* xs, const double* ys, int count, double width, int offset, int stride) {
|
template void PlotBars<ImS64>(const char* label_id, const ImS64* xs, const ImS64* ys, int count, double width, int offset, int stride);
|
||||||
GetterXsYs<double> getter(xs,ys,count,offset,stride);
|
template void PlotBars<ImU64>(const char* label_id, const ImU64* xs, const ImU64* ys, int count, double width, int offset, int stride);
|
||||||
PlotBarsEx(label_id, getter, width);
|
template void PlotBars<float>(const char* label_id, const float* xs, const float* ys, int count, double width, int offset, int stride);
|
||||||
}
|
template void PlotBars<double>(const char* label_id, const double* xs, const double* ys, int count, double width, int offset, int stride);
|
||||||
|
|
||||||
// custom
|
// custom
|
||||||
void PlotBars(const char* label_id, ImPlotPoint (*getter_func)(void* data, int idx), void* data, int count, double width, int offset) {
|
void PlotBarsG(const char* label_id, ImPlotPoint (*getter_func)(void* data, int idx), void* data, int count, double width, int offset) {
|
||||||
GetterFuncPtrImPlotPoint getter(getter_func, data, count, offset);
|
GetterFuncPtrImPlotPoint getter(getter_func, data, count, offset);
|
||||||
PlotBarsEx(label_id, getter, width);
|
PlotBarsEx(label_id, getter, width);
|
||||||
}
|
}
|
||||||
|
@ -1154,30 +1194,41 @@ void PlotBarsHEx(const char* label_id, Getter getter, THeight height) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// float
|
template <typename T>
|
||||||
void PlotBarsH(const char* label_id, const float* values, int count, float height, float shift, int offset, int stride) {
|
void PlotBarsH(const char* label_id, const T* values, int count, double height, double shift, int offset, int stride) {
|
||||||
GetterBarH<float> getter(values,shift,count,offset,stride);
|
GetterBarH<T> getter(values,shift,count,offset,stride);
|
||||||
PlotBarsHEx(label_id, getter, height);
|
PlotBarsHEx(label_id, getter, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotBarsH(const char* label_id, const float* xs, const float* ys, int count, float height, int offset, int stride) {
|
template void PlotBarsH<ImS8>(const char* label_id, const ImS8* values, int count, double height, double shift, int offset, int stride);
|
||||||
GetterXsYs<float> getter(xs,ys,count,offset,stride);
|
template void PlotBarsH<ImU8>(const char* label_id, const ImU8* values, int count, double height, double shift, int offset, int stride);
|
||||||
PlotBarsHEx(label_id, getter, height);
|
template void PlotBarsH<ImS16>(const char* label_id, const ImS16* values, int count, double height, double shift, int offset, int stride);
|
||||||
}
|
template void PlotBarsH<ImU16>(const char* label_id, const ImU16* values, int count, double height, double shift, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImS32>(const char* label_id, const ImS32* values, int count, double height, double shift, int offset, int stride);
|
||||||
// double
|
template void PlotBarsH<ImU32>(const char* label_id, const ImU32* values, int count, double height, double shift, int offset, int stride);
|
||||||
void PlotBarsH(const char* label_id, const double* values, int count, double height, double shift, int offset, int stride) {
|
template void PlotBarsH<ImS64>(const char* label_id, const ImS64* values, int count, double height, double shift, int offset, int stride);
|
||||||
GetterBarH<double> getter(values,shift,count,offset,stride);
|
template void PlotBarsH<ImU64>(const char* label_id, const ImU64* values, int count, double height, double shift, int offset, int stride);
|
||||||
PlotBarsHEx(label_id, getter, height);
|
template void PlotBarsH<float>(const char* label_id, const float* values, int count, double height, double shift, int offset, int stride);
|
||||||
}
|
template void PlotBarsH<double>(const char* label_id, const double* values, int count, double height, double shift, int offset, int stride);
|
||||||
|
|
||||||
void PlotBarsH(const char* label_id, const double* xs, const double* ys, int count, double height, int offset, int stride) {
|
template <typename T>
|
||||||
GetterXsYs<double> getter(xs,ys,count,offset,stride);
|
void PlotBarsH(const char* label_id, const T* xs, const T* ys, int count, double height, int offset, int stride) {
|
||||||
|
GetterXsYs<T> getter(xs,ys,count,offset,stride);
|
||||||
PlotBarsHEx(label_id, getter, height);
|
PlotBarsHEx(label_id, getter, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template void PlotBarsH<ImS8>(const char* label_id, const ImS8* xs, const ImS8* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImU8>(const char* label_id, const ImU8* xs, const ImU8* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImS16>(const char* label_id, const ImS16* xs, const ImS16* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImU16>(const char* label_id, const ImU16* xs, const ImU16* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImS32>(const char* label_id, const ImS32* xs, const ImS32* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImU32>(const char* label_id, const ImU32* xs, const ImU32* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImS64>(const char* label_id, const ImS64* xs, const ImS64* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<ImU64>(const char* label_id, const ImU64* xs, const ImU64* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<float>(const char* label_id, const float* xs, const float* ys, int count, double height, int offset, int stride);
|
||||||
|
template void PlotBarsH<double>(const char* label_id, const double* xs, const double* ys, int count, double height, int offset, int stride);
|
||||||
// custom
|
// custom
|
||||||
void PlotBarsH(const char* label_id, ImPlotPoint (*getter_func)(void* data, int idx), void* data, int count, double height, int offset) {
|
void PlotBarsHG(const char* label_id, ImPlotPoint (*getter_func)(void* data, int idx), void* data, int count, double height, int offset) {
|
||||||
GetterFuncPtrImPlotPoint getter(getter_func, data, count, offset);
|
GetterFuncPtrImPlotPoint getter(getter_func, data, count, offset);
|
||||||
PlotBarsHEx(label_id, getter, height);
|
PlotBarsHEx(label_id, getter, height);
|
||||||
}
|
}
|
||||||
|
@ -1347,13 +1398,13 @@ void PlotStems(const char* label_id, const double* values, int count, double y_r
|
||||||
|
|
||||||
void PlotStems(const char* label_id, const float* xs, const float* ys, int count, float y_ref, int offset, int stride) {
|
void PlotStems(const char* label_id, const float* xs, const float* ys, int count, float y_ref, int offset, int stride) {
|
||||||
GetterXsYs<float> get_mark(xs,ys,count,offset,stride);
|
GetterXsYs<float> get_mark(xs,ys,count,offset,stride);
|
||||||
GetterXsYRef<float> get_base(xs,y_ref,count,offset,stride);
|
GetterXsYRef<float,float> get_base(xs,y_ref,count,offset,stride);
|
||||||
PlotStemsEx(label_id, get_mark, get_base);
|
PlotStemsEx(label_id, get_mark, get_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotStems(const char* label_id, const double* xs, const double* ys, int count, double y_ref, int offset, int stride) {
|
void PlotStems(const char* label_id, const double* xs, const double* ys, int count, double y_ref, int offset, int stride) {
|
||||||
GetterXsYs<double> get_mark(xs,ys,count,offset,stride);
|
GetterXsYs<double> get_mark(xs,ys,count,offset,stride);
|
||||||
GetterXsYRef<double> get_base(xs,y_ref,count,offset,stride);
|
GetterXsYRef<double,double> get_base(xs,y_ref,count,offset,stride);
|
||||||
PlotStemsEx(label_id, get_mark, get_base);
|
PlotStemsEx(label_id, get_mark, get_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user