void City::draw(string _chartType, bool _drawValues){ // Label ofPoint pos; pos.set(10, (cityIndex + 1) * 20); ofSetColor(highColor); ofDrawBitmapString("[" + ofToString(cityIndex + 1) + "] " + name, pos); // Chart if(isVisible){ if (_chartType == "line"){ drawLineChart(_drawValues); }else if(_chartType == "area"){ drawAreaChart(_drawValues); }else if(_chartType == "bar"){ drawBarChart(_drawValues); } } }
// draw the chartchartheight void QTAChartCore::draw (void) { QWidget *gqw; QTACObject *object, *delobject; if (Q_UNLIKELY (!tfinit)) { QString title; createTFButtons (); HLOC = &TIMEFRAME[0].HLOC; HEIKINASHI = &TIMEFRAME[0].HEIKINASHI; startbar = &TIMEFRAME[0].TFStartBar; excess_drag_width = &TIMEFRAME[0].TFExcess_Drag_Width; title = Symbol + " - " + TIMEFRAME[0].TFName; currenttf = TIMEFRAME[0].TFName; setTitle (title, QString::fromUtf8 (subtitletext)); tfinit = true; } // collect garbage objects do { delobject = NULL; foreach (object, Object) if (object->deleteit) delobject = object; if (delobject != NULL) deleteObject (delobject); } while (delobject != NULL); // collect garbase QWidgets if (garbageQWidget.size () > 0) { gqw = garbageQWidget[0]; gqw->deleteLater (); garbageQWidget.remove (0); } if (reloaded) { points = maxdecimals (HLOC); decimals = qCeil (qAbs (qLog10 (points))); OPEN.clear (); CLOSE.clear (); HIGH.clear (); LOW.clear (); VOLUME.clear (); foreach (const QTAChartFrame &frame, *HLOC) { OPEN += frame.Open; CLOSE += frame.Close; HIGH += frame.High; LOW += frame.Low; VOLUME += frame.Volume; } reloaded = false; } // geometry geom (this); // draw the objects foreach (object, Object) object->draw (); // draw the chart frame, grid, bottom text ruller_cursor_x = chartrightmost + 2; ruller_cursor->setPos (ruller_cursor_x, ruller_cursor_y); bottom_text->setPos (chartleftmost, height - (bottomline_height + 5)); topedge->setLine (chartleftmost, charttopmost, chartrightmost + 3, charttopmost); bottomedge->setLine (chartleftmost, chartbottomost + 5, width, chartbottomost + 5); rightedge->setLine (chartrightmost + 3, 0, chartrightmost + 3, height); leftedge->setLine (chartleftmost, 0, chartleftmost, height); if (show_grid) drawGRID (); else clearGRID (); if (linear) scaletitle->setPlainText ("Linear"); else scaletitle->setPlainText ("Logarithmic"); if (chart_style == QTACHART_CANDLE) { typetitle->setPlainText ("Candle"); drawCandleChart (); } else if (chart_style == QTACHART_HEIKINASHI) { typetitle->setPlainText ("Heikin-Ashi"); drawCandleChart (); } else if (chart_style == QTACHART_BAR) { typetitle->setPlainText ("Bar"); drawBarChart (); } else if (chart_style == QTACHART_LINE) { typetitle->setPlainText ("Line"); drawPriceLine (linecolor, linethickness); } clearITEMS (); setRullerCursor (ruller_cursor_y); }