mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 10:18:52 -05:00
Compare commits
3 Commits
8250340f04
...
c2b30bc47b
Author | SHA1 | Date | |
---|---|---|---|
Gordon McCann | c2b30bc47b | ||
Gordon McCann | 96412c79fe | ||
Gordon McCann | 57f46bfc00 |
|
@ -751,13 +751,13 @@ void ShowDemo_DigitalPlots() {
|
||||||
ImPlot::SetupAxisLimits(ImAxis_Y1, -1, 1);
|
ImPlot::SetupAxisLimits(ImAxis_Y1, -1, 1);
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
if (showDigital[i] && dataDigital[i].Data.size() > 0) {
|
if (showDigital[i] && dataDigital[i].Data.size() > 0) {
|
||||||
sprintf(label, "digital_%d", i);
|
snprintf(label, sizeof(label), "digital_%d", i);
|
||||||
ImPlot::PlotDigital(label, &dataDigital[i].Data[0].x, &dataDigital[i].Data[0].y, dataDigital[i].Data.size(), dataDigital[i].Offset, 2 * sizeof(float));
|
ImPlot::PlotDigital(label, &dataDigital[i].Data[0].x, &dataDigital[i].Data[0].y, dataDigital[i].Data.size(), dataDigital[i].Offset, 2 * sizeof(float));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
if (showAnalog[i]) {
|
if (showAnalog[i]) {
|
||||||
sprintf(label, "analog_%d", i);
|
snprintf(label, sizeof(label), "analog_%d", i);
|
||||||
if (dataAnalog[i].Data.size() > 0)
|
if (dataAnalog[i].Data.size() > 0)
|
||||||
ImPlot::PlotLine(label, &dataAnalog[i].Data[0].x, &dataAnalog[i].Data[0].y, dataAnalog[i].Data.size(), dataAnalog[i].Offset, 2 * sizeof(float));
|
ImPlot::PlotLine(label, &dataAnalog[i].Data[0].x, &dataAnalog[i].Data[0].y, dataAnalog[i].Data.size(), dataAnalog[i].Offset, 2 * sizeof(float));
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1118,7 @@ void ShowDemo_SubplotItemSharing() {
|
||||||
if (id[j] == i) {
|
if (id[j] == i) {
|
||||||
char label[8];
|
char label[8];
|
||||||
float fj = 0.01f * (j+2);
|
float fj = 0.01f * (j+2);
|
||||||
sprintf(label, "data%d", j);
|
snprintf(label, sizeof(label), "data%d", j);
|
||||||
ImPlot::PlotLineG(label,SinewaveGetter,&fj,1000);
|
ImPlot::PlotLineG(label,SinewaveGetter,&fj,1000);
|
||||||
if (ImPlot::BeginDragDropSourceItem(label)) {
|
if (ImPlot::BeginDragDropSourceItem(label)) {
|
||||||
curj = j;
|
curj = j;
|
||||||
|
@ -1445,7 +1445,7 @@ void ShowDemo_DragAndDrop() {
|
||||||
Idx = i++;
|
Idx = i++;
|
||||||
Plt = 0;
|
Plt = 0;
|
||||||
Yax = ImAxis_Y1;
|
Yax = ImAxis_Y1;
|
||||||
sprintf(Label, "%02d Hz", Idx+1);
|
snprintf(Label, sizeof(Label), "%02d Hz", Idx+1);
|
||||||
Color = RandomColor();
|
Color = RandomColor();
|
||||||
Data.reserve(1001);
|
Data.reserve(1001);
|
||||||
for (int k = 0; k < 1001; ++k) {
|
for (int k = 0; k < 1001; ++k) {
|
||||||
|
@ -1656,7 +1656,7 @@ void ShowDemo_OffsetAndStride() {
|
||||||
ImPlot::PushColormap(ImPlotColormap_Jet);
|
ImPlot::PushColormap(ImPlotColormap_Jet);
|
||||||
char buff[16];
|
char buff[16];
|
||||||
for (int c = 0; c < k_circles; ++c) {
|
for (int c = 0; c < k_circles; ++c) {
|
||||||
sprintf(buff, "Circle %d", c);
|
snprintf(buff, sizeof(buff), "Circle %d", c);
|
||||||
ImPlot::PlotLine(buff, &interleaved_data[c*2 + 0], &interleaved_data[c*2 + 1], k_points_per, offset, 2*k_circles*sizeof(double));
|
ImPlot::PlotLine(buff, &interleaved_data[c*2 + 0], &interleaved_data[c*2 + 1], k_points_per, offset, 2*k_circles*sizeof(double));
|
||||||
}
|
}
|
||||||
ImPlot::EndPlot();
|
ImPlot::EndPlot();
|
||||||
|
@ -2381,7 +2381,7 @@ void ShowBenchmarkTool() {
|
||||||
ImPlot::SetupAxesLimits(0,500,0,500,ImGuiCond_Always);
|
ImPlot::SetupAxesLimits(0,500,0,500,ImGuiCond_Always);
|
||||||
for (int run = 0; run < records.size(); ++run) {
|
for (int run = 0; run < records.size(); ++run) {
|
||||||
if (records[run].Data.Size > 1) {
|
if (records[run].Data.Size > 1) {
|
||||||
sprintf(buffer, "B%d-%s%s", run + 1, names[records[run].Mode], records[run].AA ? "-AA" : "");
|
snprintf(buffer, sizeof(buffer), "B%d-%s%s", run + 1, names[records[run].Mode], records[run].AA ? "-AA" : "");
|
||||||
ImVector<ImPlotPoint>& d = records[run].Data;
|
ImVector<ImPlotPoint>& d = records[run].Data;
|
||||||
ImPlot::PlotLine(buffer, &d[0].x, &d[0].y, d.Size, 0, 2*sizeof(double));
|
ImPlot::PlotLine(buffer, &d[0].x, &d[0].y, d.Size, 0, 2*sizeof(double));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1815,7 +1815,7 @@ void PlotPieChart(const char* const label_ids[], const T* values, int count, dou
|
||||||
double percent = normalize ? (double)values[i] / sum : (double)values[i];
|
double percent = normalize ? (double)values[i] / sum : (double)values[i];
|
||||||
a1 = a0 + 2 * IM_PI * percent;
|
a1 = a0 + 2 * IM_PI * percent;
|
||||||
if (item->Show) {
|
if (item->Show) {
|
||||||
sprintf(buffer, fmt, (double)values[i]);
|
snprintf(buffer, sizeof(buffer), fmt, (double)values[i]);
|
||||||
ImVec2 size = ImGui::CalcTextSize(buffer);
|
ImVec2 size = ImGui::CalcTextSize(buffer);
|
||||||
double angle = a0 + (a1 - a0) * 0.5;
|
double angle = a0 + (a1 - a0) * 0.5;
|
||||||
ImVec2 pos = PlotToPixels(center.x + 0.5 * radius * cos(angle), center.y + 0.5 * radius * sin(angle),IMPLOT_AUTO,IMPLOT_AUTO);
|
ImVec2 pos = PlotToPixels(center.x + 0.5 * radius * cos(angle), center.y + 0.5 * radius * sin(angle),IMPLOT_AUTO,IMPLOT_AUTO);
|
||||||
|
@ -1978,7 +1978,7 @@ void RenderHeatmap(Transformer transformer, ImDrawList& DrawList, const T* value
|
||||||
p.y = yref + ydir * (0.5*h + r*h);
|
p.y = yref + ydir * (0.5*h + r*h);
|
||||||
ImVec2 px = transformer(p);
|
ImVec2 px = transformer(p);
|
||||||
char buff[32];
|
char buff[32];
|
||||||
sprintf(buff, fmt, values[i]);
|
snprintf(buff, sizeof(buff), fmt, values[i]);
|
||||||
ImVec2 size = ImGui::CalcTextSize(buff);
|
ImVec2 size = ImGui::CalcTextSize(buff);
|
||||||
double t = ImClamp(ImRemap01((double)values[i], scale_min, scale_max),0.0,1.0);
|
double t = ImClamp(ImRemap01((double)values[i], scale_min, scale_max),0.0,1.0);
|
||||||
ImVec4 color = SampleColormap((float)t);
|
ImVec4 color = SampleColormap((float)t);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user