Example #1
0
void Graph::showCurve(const QVariant &itemInfo, bool on, int index )
{
    QwtPlotItem *it = infoToItem(itemInfo);
    if(it)
        it->setVisible(on);

    if(legend())
    {
        QWidget *w = ((QwtLegend*)legend())->legendWidget(itemInfo);
        if(w && w->inherits("QwtLegendLabel"))
            ((QwtLegendLabel*)w)->setChecked(on);
    }

    replot();
}
Example #2
0
void QcepPlot::onLegendChecked(const QVariant &itemInfo, bool on, int index)
{
//  if (g_Application) {
//    g_Application->printMessage(tr("QxrdPlot::onLegendChecked(%1,%2,%3)").arg(itemInfo.toString()).arg(on).arg(index));
//  }

  QwtPlotItem *item = infoToItem(itemInfo);

  if (item) {
    QwtPlotCurve *pc = dynamic_cast<QwtPlotCurve*>(item);

    if (pc) {
      QPen pen = pc->pen();
      const QwtSymbol *oldsym = pc->symbol();
      QwtSymbol *sym = NULL;

      if (oldsym) {
       sym = new QwtSymbol(oldsym->style(), oldsym->brush(), oldsym->pen(), oldsym->size());
      }

      if (on) {
        pen.setWidth(3);
        if (sym) {
          sym->setSize(9,9);
        }
      } else {
        pen.setWidth(1);
        if (sym) {
          sym->setSize(5,5);
        }
      }
      pc->setPen(pen);
      if (sym) {
        pc->setSymbol(sym);
      }
    }

    replot();
  }
}
Example #3
0
void CpuPlot::legendChecked( const QVariant &itemInfo, bool on ) {
    QwtPlotItem *plotItem = infoToItem( itemInfo );
    if ( plotItem )
        showCurve( plotItem, on );
}
Example #4
0
void TVPlot::showItem( const QVariant &itemInfo, bool on )
{
    QwtPlotItem *plotItem = infoToItem( itemInfo );
    if ( plotItem )
        plotItem->setVisible( on );
}