// Get the series portion of the tip for this group in this series. CString MyGraphSeries::GetTipText(int nGroup, const CString &unitString) const { VALIDATE; _ASSERTE(0 <= nGroup); _ASSERTE(m_oaRegions.GetSize() <= m_dwaValues.GetSize()); CString sTip; sTip.Format(_T("%d %s (%d%%)"), m_dwaValues.GetAt(nGroup), (LPCTSTR)unitString, GetDataTotal() ? (int) (100.0 * (double) m_dwaValues.GetAt(nGroup) / (double) GetDataTotal()) : 0); return sTip; }
/* * Draws the x and y axis of the graph with a given width and height for each axis */ void BarChart::DrawAxis(float width, float height) { // end points for each axis. endX = START_X + width; endY = START_Y + height; FontRenderer::RenderText(title, 0.5f, START_X, endY + 90.0f, Vector3f(0.0f, 1.0f, 1.0f), true); glLineWidth(1.3f); glBegin(GL_LINES); // Draw X Axis glColor3f(1.0f, 0.0f, 0.0f); glVertex2f(START_X, START_Y); glVertex2f(endX, START_Y); // Draw Y Axis glColor3f(0.0f, 1.0f, 0.0f); glVertex2f(START_X, START_Y + 0.5f); glVertex2f(START_X, endY); glEnd(); // Draw lowest value (0) for the Y axis FontRenderer::RenderText("Y : 0", 0.3f, START_X - 80.0f, START_Y + 15.0f, Vector3f(0.0f, 1.0f, 0.0f)); // Draw highest value for the Y axis FontRenderer::RenderText("Y : " + std::to_string(GetDataTotal()), 0.3f, START_X - 80.0f, endY + 40.0f, Vector3f(0.0f, 1.0f, 0.0f)); }