implotWrapper.cpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. #include "implot.h"
  2. #include "implotWrapper.h"
  3. #include "WrapperConverter.h"
  4. void iggImPlotSetNextPlotLimits(double xmin, double xmax, double ymin, double ymax, int cond)
  5. {
  6. ImPlot::SetNextPlotLimits(xmin, xmax, ymin, ymax, cond);
  7. }
  8. void iggImPlotSetNextPlotTicksX(const double* values, int n_ticks, const char* const labels[], IggBool show_default)
  9. {
  10. ImPlot::SetNextPlotTicksX(values, n_ticks, labels, show_default);
  11. }
  12. void iggImPlotSetNextPlotTicksY(const double* values, int n_ticks, const char* const labels[], IggBool show_default, int y_axis)
  13. {
  14. ImPlot::SetNextPlotTicksY(values, n_ticks, labels, show_default, y_axis);
  15. }
  16. void iggImPlotFitNextPlotAxes(IggBool x, IggBool y, IggBool y2, IggBool y3)
  17. {
  18. ImPlot::FitNextPlotAxes(x, y, y2, y3);
  19. }
  20. IggImPlotContext iggImPlotCreateContext()
  21. {
  22. ImPlotContext *context = ImPlot::CreateContext();
  23. ImPlot::GetStyle().AntiAliasedLines = true;
  24. return reinterpret_cast<IggImPlotContext>(context);
  25. }
  26. void iggImPlotDestroyContext()
  27. {
  28. ImPlot::DestroyContext();
  29. }
  30. IggBool iggImPlotBeginPlot(const char* title_id,
  31. const char* x_label,
  32. const char* y_label,
  33. const IggVec2* size,
  34. int flags,
  35. int x_flags,
  36. int y_flags,
  37. int y2_flags,
  38. int y3_flags,
  39. const char* y2_label,
  40. const char* y3_label)
  41. {
  42. Vec2Wrapper sizeArg(size);
  43. return ImPlot::BeginPlot(title_id, x_label, y_label, *sizeArg, flags, x_flags, y_flags, y2_flags, y3_flags, y2_label, y3_label);
  44. }
  45. void iggImPlotEndPlot()
  46. {
  47. ImPlot::EndPlot();
  48. }
  49. void iggImPlotBars(const char* label_id, const double* values, int count, double width, double shift, int offset)
  50. {
  51. ImPlot::PlotBars(label_id, values, count, width, shift, offset);
  52. }
  53. void iggImPlotBarsXY(const char* label_id, const double* xs, const double* ys, int count, double width, int offset)
  54. {
  55. ImPlot::PlotBars(label_id, xs, ys, count, width, offset);
  56. }
  57. void iggImPlotBarsH(const char* label_id, const double* values, int count, double height, double shift, int offset)
  58. {
  59. ImPlot::PlotBarsH(label_id, values, count, height, shift, offset);
  60. }
  61. void iggImPlotBarsHXY(const char* label_id, const double* xs, const double* ys, int count, double height, int offset)
  62. {
  63. ImPlot::PlotBarsH(label_id, xs, ys, count, height, offset);
  64. }
  65. void iggImPlotErrorBars(const char* label_id, const double* xs, const double* ys, const double* err, int count, int offset)
  66. {
  67. ImPlot::PlotErrorBars(label_id, xs, ys, err, count, offset);
  68. }
  69. void iggImPlotErrorBarsH(const char* label_id, const double* xs, const double* ys, const double* err, int count, int offset)
  70. {
  71. ImPlot::PlotErrorBarsH(label_id, xs, ys, err, count, offset);
  72. }
  73. void iggImPlotLine(const char* label_id, const double* values, int count, double xscale, double x0, int offset)
  74. {
  75. ImPlot::PlotLine(label_id, values, count, xscale, x0, offset);
  76. }
  77. void iggImPlotLineXY(const char* label_id, const double* xs, const double* ys, int count, int offset)
  78. {
  79. ImPlot::PlotLine(label_id, xs, ys, count, offset);
  80. }
  81. void iggImPlotScatter(const char* label_id, const double* values, int count, double xscale, double x0, int offset)
  82. {
  83. ImPlot::PlotScatter(label_id, values, count, xscale, x0, offset);
  84. }
  85. void iggImPlotScatterXY(const char* label_id, const double* xs, const double* ys, int count, int offset)
  86. {
  87. ImPlot::PlotScatter(label_id, xs, ys, count, offset);
  88. }
  89. void iggImPlotStairs(const char* label_id, const double* values, int count, double xscale, double x0, int offset)
  90. {
  91. ImPlot::PlotStairs(label_id, values, count, xscale, x0, offset);
  92. }
  93. void iggImPlotStairsXY(const char* label_id, const double* xs, const double* ys, int count, int offset)
  94. {
  95. ImPlot::PlotStairs(label_id, xs, ys, count, offset);
  96. }
  97. void iggImPlotStems(const char* label_id, const double* values, int count, double y_ref, double xscale, double x0, int offset)
  98. {
  99. ImPlot::PlotStems(label_id, values, count, y_ref, xscale, x0, offset);
  100. }
  101. void iggImPlotStemsXY(const char* label_id, const double* xs, const double* ys, int count, double y_ref, int offset)
  102. {
  103. ImPlot::PlotStems(label_id, xs, ys, count, y_ref, offset);
  104. }
  105. void iggImPlotVLines(const char* label_id, const double* xs, int count, int offset)
  106. {
  107. ImPlot::PlotVLines(label_id, xs, count, offset);
  108. }
  109. void iggImPlotHLines(const char* label_id, const double* ys, int count, int offset)
  110. {
  111. ImPlot::PlotHLines(label_id, ys, count, offset);
  112. }
  113. void iggImPlotPieChart(const char* const label_ids[], const double* values, int count, double x, double y, double radius, IggBool normalize, const char* label_fmt, double angle0)
  114. {
  115. ImPlot::PlotPieChart(label_ids, values, count, x, y, radius, normalize, label_fmt, angle0);
  116. }
  117. void iggImPlotGetPlotPos(IggVec2 *pos)
  118. {
  119. exportValue(*pos, ImPlot::GetPlotPos());
  120. }
  121. void iggImPlotGetPlotSize(IggVec2 *size)
  122. {
  123. exportValue(*size, ImPlot::GetPlotSize());
  124. }
  125. IggBool iggImPlotIsPlotHovered() {
  126. return ImPlot::IsPlotHovered() ? 1 : 0;
  127. }
  128. IggBool iggImPlotIsPlotXAxisHovered()
  129. {
  130. return ImPlot::IsPlotXAxisHovered() ? 1 : 0;
  131. }
  132. IggBool iggImPlotIsPlotYAxisHovered(int y_axis)
  133. {
  134. return ImPlot::IsPlotYAxisHovered(y_axis) ? 1 : 0;
  135. }
  136. void iggImPlotUseLocalTime(IggBool localtime)
  137. {
  138. ImPlot::GetStyle().UseLocalTime = localtime;
  139. }
  140. void iggImPlotUseISO8601(IggBool iso8601)
  141. {
  142. ImPlot::GetStyle().UseISO8601 = iso8601;
  143. }
  144. void iggImPlotUse24HourClock(IggBool clock24h)
  145. {
  146. ImPlot::GetStyle().Use24HourClock = clock24h;
  147. }
  148. void iggImPlotSetPlotYAxis(int y_axis)
  149. {
  150. ImPlot::SetPlotYAxis(y_axis);
  151. }