View Poll Results: Histogram: How changing the color of one balk ?

Voters
1. You may not vote on this poll
  • Qwt

    1 100.00%
  • Qt

    1 100.00%
  • Qwt

    1 100.00%
  • Qwt

    1 100.00%
Multiple Choice Poll.
Results 1 to 5 of 5

Thread: Histogram: Changing the color of one specific balk

  1. #1
    Join Date
    Aug 2010
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Talking Histogram: Changing the color of one specific balk

    Hello folks,

    I have an histogram having eaxctly 7 balk with the green color for all balk, but i am looking for a way on how to paint (e.g. blue) only and only one balk for a specific reasons. This is important for me in order to show specific details. my code:

    QwtPlot plot;
    plot.setCanvasBackground(QColor(Qt::black));
    plot.setTitle("Histogram: Test Diagram ");

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin(true);
    grid->enableYMin(true);
    grid->setMajPen(QPen(Qt::gray, 0, Qt:otLine));
    grid->setMinPen(QPen(Qt::gray, 0, Qt:otLine));
    grid->attach(&plot);
    ....
    ....
    ....
    plot.setAxisTitle(QwtPlot::yLeft, " number ");
    plot.setAxisScale(QwtPlot::yLeft, 0.0, DATA_NUMBER);
    plot.setAxisTitle(QwtPlot::xBottom, " <- Datatypen -> ");

    plot.setAxisScaleDraw(QwtPlot::xBottom, new DataScaleDraw());
    plot.setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
    plot.setAxisScale(QwtPlot::xBottom, 0.0, DATA_TYPE_NUMBER);
    plot.setAxisMaxMinor(QwtPlot::xBottom, 0);

    Note: DataScaleDraw() is following:

    class DataScaleDraw: public QwtScaleDraw
    {
    public:
    DataScaleDraw()
    {
    }
    virtual QwtText label(double v) const
    {
    switch (int(v))
    { case 1: return QString(" PP "); break;
    case 2: return QString(" AP "); break;
    case 3: return QString(" PM "); break;
    case 4: return QString(" FM "); break;
    case 5: return QString(" DD "); break;
    case 6: return QString(" SS "); break;
    case 7: return QString(" GG "); break;
    }

    return QwtScaleDraw::label(v);
    }
    };

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Histogram: Changing the color of one specific balk

    At least you have to tell us what type of plot item you are using to display your histogram.

    Uwe

    PS: What is the point behind the poll ?

  3. #3
    Join Date
    Aug 2010
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Histogram: Changing the color of one specific balk

    Uwe

    Many thanks, but I am sorry for having small skills with Qwt. My Histogram class is derived from QwtPoltItem (This class was taken out from the qwt examples, the only change were my own DataScaledraw class).
    ...
    ...
    HistogramItem *histogram = new HistogramItem();
    histogram->setColor(Qt::darkGreen);
    ...

    The Point behind the poll is following:
    My Histogram describes a statistical spreading for a specific measurements, but for a given component with a higher frequency of occurence within the Histogram, I have to highly this by using another color within the histogram. For example, I have 7 measurements components, by which 6 components has x+i frequency of occurence. All those are represented into my Histogram with green balk. okay. However the component with the higher value of frequency must be displayed into the same Histogram with another color(e.g. blue).

    Thanks in advance.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Histogram: Changing the color of one specific balk

    Quote Originally Posted by Agfels View Post
    My Histogram class is derived from QwtPoltItem (This class was taken out from the qwt examples
    Well, this example shows how you could implement a histogram. If you want to go with it you have to understand and modify it ( what isn't to hard, when you have more than only very basic Qt know how ).

    Otherwise use Qwt from SVN trunk. It includes a new plot item called QwtPlotHistogram.

    Quote Originally Posted by Agfels View Post
    The Point behind the poll is following:
    This explains your posting, but not a poll.

    Uwe

  5. #5
    Join Date
    Aug 2010
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Histogram: Changing the color of one specific balk

    Thanks Uwe,

    could you please point me (e.g. URL name) on how to get access to this trunk via TortoisesSVN ? I need this new Histogramm class absolutely.

    Thanks

Similar Threads

  1. changing color of QTable
    By aj2903 in forum Qt Programming
    Replies: 7
    Last Post: 30th October 2009, 13:52
  2. Dynamically changing QFrame color
    By Doug Broadwell in forum Newbie
    Replies: 6
    Last Post: 16th October 2008, 09:22
  3. Qt Opengl, Changing objects color
    By bod in forum Qt Programming
    Replies: 4
    Last Post: 2nd July 2008, 14:13
  4. Replies: 1
    Last Post: 17th March 2006, 09:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.