CStatic-derived histogram control





5.00/5 (11 votes)
Jan 10, 2000

89934

3503
A simple histogram control for displaying data
The CAlexfStaticHistogram
control is a lightweight class suitable for displaying histograms. You can add new columns, additional text, change text orientation and direction of motion (if you change data at runtime).
Using CAlexfStaticHistogram
in a dialog is quite simple:
- Include CAlexfStaticHistogram.h in your dialog class' header file.
- Add member variables of type CAlexfStaticHistogram for every static text control you want to subclass.
- Subclass the static text controls in your dialog's OnInitDialog() method and set the controls' style.
m_sHistogram.SetTextWidth(50); // Set text width (0 - no text) m_sHistogram.SetTextLines(5); // Set number of text lines (0 - none) m_sHistogram.text[0] = "Z1"; // Set text (too easy to create special m_sHistogram.text[1] = "Zz2"; // function for that) // ... m_sHistogram.SetMaxValue(99.9) // Set relatival maximum m_sHistogram.Add(50); // Add new column to histogram
If you want "dynamic" histogram - you can owerride, for example, OnTimer()
and simply call:
m_sHistogram.Add(/*Value*/);
Please feel free to send me any suggestions about this control.