mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 20:28:50 -05:00
add appropriate space for X tick labels with newlines (#214)
When painting a graph with densely labeled ticks on the X axis, it may be necessary to add newlines in the labels to avoid label text overlap. Reserve appropriate padding space for that.
This commit is contained in:
parent
04ae3728f8
commit
555ff688a8
|
@ -1532,7 +1532,7 @@ bool BeginPlot(const char* title, const char* x_label, const char* y1_label, con
|
|||
const bool show_x_label = x_label && !ImHasFlag(plot.XAxis.Flags, ImPlotAxisFlags_NoLabel);
|
||||
|
||||
const float pad_top = title_size.x > 0.0f ? txt_height + gp.Style.LabelPadding.y : 0;
|
||||
const float pad_bot = (plot.XAxis.IsLabeled() ? txt_height + gp.Style.LabelPadding.y + (plot.XAxis.IsTime() ? txt_height + gp.Style.LabelPadding.y : 0) : 0)
|
||||
const float pad_bot = (plot.XAxis.IsLabeled() ? ImMax(txt_height, gp.XTicks.MaxHeight) + gp.Style.LabelPadding.y + (plot.XAxis.IsTime() ? txt_height + gp.Style.LabelPadding.y : 0) : 0)
|
||||
+ (show_x_label ? txt_height + gp.Style.LabelPadding.y : 0);
|
||||
|
||||
const float plot_height = plot.CanvasRect.GetHeight() - pad_top - pad_bot;
|
||||
|
|
Loading…
Reference in New Issue
Block a user