| 1635 | } |
| 1636 | |
| 1637 | void LabelAxisValue(const ImPlotAxis& axis, double value, char* buff, int size, bool round) { |
| 1638 | ImPlotContext& gp = *GImPlot; |
| 1639 | // TODO: We shouldn't explicitly check that the axis is Time here. Ideally, |
| 1640 | // Formatter_Time would handle the formatting for us, but the code below |
| 1641 | // needs additional arguments which are not currently available in ImPlotFormatter |
| 1642 | if (axis.Locator == Locator_Time) { |
| 1643 | ImPlotTimeUnit unit = axis.Vertical |
| 1644 | ? GetUnitForRange(axis.Range.Size() / (gp.CurrentPlot->PlotRect.GetHeight() / 100)) // TODO: magic value! |
| 1645 | : GetUnitForRange(axis.Range.Size() / (gp.CurrentPlot->PlotRect.GetWidth() / 100)); // TODO: magic value! |
| 1646 | FormatDateTime(ImPlotTime::FromDouble(value), buff, size, GetDateTimeFmt(TimeFormatMouseCursor, unit)); |
| 1647 | } |
| 1648 | else { |
| 1649 | if (round) |
| 1650 | value = RoundAxisValue(axis, value); |
| 1651 | axis.Formatter(value, buff, size, axis.FormatterData); |
| 1652 | } |
| 1653 | } |
| 1654 | |
| 1655 | void UpdateAxisColors(ImPlotAxis& axis) { |
| 1656 | const ImVec4 col_grid = GetStyleColorVec4(ImPlotCol_AxisGrid); |
no test coverage detected