MCPcopy Create free account
hub / github.com/chenshuo/muduo / label

Method label

examples/procmon/plot.cc:70–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void Plot::label(double maxValue)
71{
72 char buf[64];
73 if (maxValue >= 10.0)
74 snprintf(buf, sizeof buf, "%.0f", maxValue);
75 else
76 snprintf(buf, sizeof buf, "%.1f", maxValue);
77
78 gdImageString(image_,
79 font_,
80 width_ - kRightMargin_ + 3,
81 kMarginY_ - 3,
82 reinterpret_cast<unsigned char*>(buf),
83 black_);
84
85 snprintf(buf, sizeof buf, "0");
86 gdImageString(image_,
87 font_,
88 width_ - kRightMargin_ + 3,
89 height_ - kMarginY_ - 3 - fontHeight_ / 2,
90 reinterpret_cast<unsigned char*>(buf),
91 gray_);
92
93 snprintf(buf, sizeof buf, "-%ds", totalSeconds_);
94 gdImageString(image_,
95 font_,
96 kLeftMargin_,
97 height_ - kMarginY_ - fontHeight_,
98 reinterpret_cast<unsigned char*>(buf),
99 blue_);
100}
101
102int Plot::getX(ssize_t i, ssize_t total) const
103{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected