def createBarChart(self, valueCount):
        chart = QChart()
        chart.setTitle("Bar chart")

        series = QStackedBarSeries(chart)

        for i, data_list in enumerate(self.m_dataTable):
            set = QBarSet("Bar set " + str(i))
            for value, _ in data_list:
                set << value.y()

            series.append(set)

        chart.addSeries(series)
        chart.createDefaultAxes()

        return chart
Beispiel #2
0
    def createBarChart(self, valueCount):
        chart = QChart()
        chart.setTitle("Bar chart")

        series = QStackedBarSeries(chart)

        for i, data_list in enumerate(self.m_dataTable):
            set = QBarSet("Bar set " + str(i))
            for value, _ in data_list:
                set << value.y()

            series.append(set)

        chart.addSeries(series)
        chart.createDefaultAxes()

        return chart
Beispiel #3
0
    def initChart(self):
        self._chart = QChart(title='数量')
        self._chart.setAnimationOptions(QChart.SeriesAnimations)
        series = QStackedBarSeries()
        series.setName('数量')
        bar_red = QBarSet('red')
        bar_red.setColor(Qt.red)
        bar_green = QBarSet('green')
        bar_green.setColor(Qt.green)
        for _, stock in self.stocks.iterrows():
            if stock['open'] < stock['close']:
                bar_red.append(stock['vol'] / 100)
                bar_green.append(0)
            else:
                bar_red.append(0)
                bar_green.append(stock['vol'] / 100)

        series.append(bar_red)
        series.append(bar_green)
        self._chart.addSeries(series)
        self._chart.createDefaultAxes()
        self._chart.setLocalizeNumbers(True)
        axis_x = self._chart.axisX()
        axis_y = self._chart.axisY()
        axis_x.setGridLineVisible(False)
        axis_y.setGridLineVisible(False)
        axis_y.setLabelFormat("%.2f")
        axis_x.setCategories(self.category)
        max_p = self.stocks[[
            'vol',
        ]].stack().max() / 100 + 10
        min_p = self.stocks[[
            'vol',
        ]].stack().min() / 100 - 10
        axis_y.setRange(min_p, max_p)

        # chart的图例
        legend = self._chart.legend()
        legend.hide()
        # 设置图例由Series来决定样式
        # legend.setMarkerShape(QLegend.MarkerShapeFromSeries)

        self.setChart(self._chart)
        self._chart.layout().setContentsMargins(0, 0, 0, 0)
        # self._chart.setMargins(QMargins(0, 0, 0, 0))
        self._chart.setBackgroundRoundness(0)
Beispiel #4
0
    def generate_chart(self):
        """Generate the bar graph for the widget."""
        self.tags = [QBarSet(tag) for tag in ["Study"]]

        series = QStackedBarSeries()

        for set in self.tags:
            series.append(set)

        self.chart = QChart()
        self.chart.addSeries(series)
        self.chart.setTitle("Total time studied (minutes per day)")

        days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
        axis = QBarCategoryAxis()
        axis.append(days)

        self.chart.createDefaultAxes()
        self.chart.setAxisX(axis, series)
        self.chart.legend().setAlignment(Qt.AlignBottom)
        self.chart.legend().setVisible(False)
        self.chart.setTheme(QChart.ChartThemeQt)
        self.chart.setBackgroundVisible(False)
        self.chart.setBackgroundRoundness(0)
        self.chart.setMargins(QMargins(0, 0, 0, 0))
        self.chart.setTitleBrush(QBrush(self.palette().text().color()))

        yAxis = self.chart.axes(Qt.Vertical)[0]
        yAxis.setGridLineVisible(False)
        yAxis.setLabelFormat("%d")
        yAxis.setLinePenColor(self.palette().text().color())
        yAxis.setLabelsColor(self.palette().text().color())

        xAxis = self.chart.axes(Qt.Horizontal)[0]
        xAxis.setGridLineVisible(False)
        xAxis.setLinePenColor(self.palette().text().color())
        xAxis.setLabelsColor(self.palette().text().color())

        chartView = QChartView(self.chart)
        chartView.setRenderHint(QPainter.Antialiasing)

        return chartView
Beispiel #5
0
    def setupUi(self, Form):
        Form.resize(800, 600)

        color = QColor("red")
        low = QBarSet("Short")
        high = QBarSet("Clear")

        low << 40.0 << 75.0 << 45.3 << 37.0 << 25.6 << 8.0 << 6.0
        # high << value[0] << value[1] << value[2] << value[3] << value[4] << value[5] << value[6]
        # high <<40 << -50 << -45.3 << -37.0 << -25.6 << -8.0 << -6.0
        high << self.percentage[0] << self.percentage[1] << self.percentage[2] << self.percentage[3] << self.percentage[4] << self.percentage[5] << self.percentage[6]

        series = QStackedBarSeries()
        series.append(low)
        series.append(high)

        chart = QChart()
        chart.addSeries(series)
        chart.setTitle("Attendance Graph")
        chart.setAnimationOptions(QChart.SeriesAnimations)

        categories = [self.Subjects[0],self.Subjects[1],self.Subjects[2],self.Subjects[3],self.Subjects[4],self.Subjects[5],self.Subjects[6]]

        axis = QBarCategoryAxis()
        axis.append(categories)
        axis.setTitleText("Month")
        chart.createDefaultAxes()
        chart.setAxisX(axis, series)
        chart.axisY(series).setRange(0, 100)
        chart.axisY(series).setTitleText("Percentage (%)")

        chart.legend().setVisible(True)
        chart.legend().setAlignment(Qt.AlignBottom)

        chartView = QChartView(chart)
        Form.setCentralWidget(chartView)
Beispiel #6
0
    def _create_revision_count_graph(self):
        stats = CollectionStats(self.col)

        categories_labels = list(range(-30, 1, 1))
        data = stats.revision_count_stats()
        data = self._transform_first_column_to_key(data)
        data = self._add_default_value_for_missing_keys(
            data, [0, 0, 0, 0, 0], categories_labels)

        series = QStackedBarSeries(self)
        setLearning = QBarSet("Learning", self)
        [setLearning.append(row[0]) for row in data]
        setYoung = QBarSet("Young", self)
        [setYoung.append(row[1]) for row in data]
        setMature = QBarSet("Mature", self)
        [setMature.append(row[2]) for row in data]
        setLapse = QBarSet("Lapse", self)
        [setLapse.append(row[3]) for row in data]
        setEarly = QBarSet("Early", self)
        [setEarly.append(row[4]) for row in data]

        categories = QBarCategoryAxis()
        categories.setCategories([str(-i) for i in categories_labels])

        series.append(setLearning)
        series.append(setYoung)
        series.append(setMature)
        series.append(setLapse)
        series.append(setEarly)

        chart = QChart()
        chart.addSeries(series)
        chart.createDefaultAxes()
        chart.setAxisX(categories, series)

        chart.setAnimationOptions(QChart.SeriesAnimations)
        chart.setTitle("Number of cards reviewed recently")

        chart.legend().setVisible(True)
        chart.legend().setAlignment(Qt.AlignBottom)

        chartview = QChartView(chart)
        chartview.setRenderHint(QPainter.Antialiasing)

        self.layout.addWidget(chartview)
Beispiel #7
0
    def _create_reviews_due_chart(self):
        ## TODO: later replace by date selector
        start, end, chunk = 0, 31, 1
        stats = CollectionStats(self.col)

        ## TODO: refactor stats._due
        categories_labels = list(range(0, 31, 1))
        data = stats.due(start, end, chunk)
        data = self._transform_first_column_to_key(data)
        data = self._add_default_value_for_missing_keys(
            data, [0, 0, 0, 0], categories_labels)

        series = QStackedBarSeries(self)
        setYoung = QBarSet("Young", self)
        [setYoung.append(row[0]) for row in data]
        setAdolescent = QBarSet("Adolescent", self)
        [setAdolescent.append(row[1]) for row in data]
        setMature = QBarSet("Mature", self)
        [setMature.append(row[2]) for row in data]
        setOld = QBarSet("Old", self)
        [setOld.append(row[3]) for row in data]

        categories = QBarCategoryAxis()
        categories.setCategories([str(i) for i in categories_labels])

        series.append(setOld)
        series.append(setMature)
        series.append(setAdolescent)
        series.append(setYoung)

        chart = QChart()
        chart.addSeries(series)
        chart.createDefaultAxes()
        chart.setAxisX(categories, series)

        chart.setAnimationOptions(QChart.SeriesAnimations)
        chart.setTitle("Forecast: the number of reviews due in the future")

        chart.legend().setVisible(True)
        chart.legend().setAlignment(Qt.AlignBottom)

        chartview = QChartView(chart)
        chartview.setRenderHint(QPainter.Antialiasing)

        self.layout.addWidget(chartview)
Beispiel #8
0
    def setupUi(self, Form):
        Form.resize(800, 600)
        Form.setWindowTitle("Analytics")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("assets/FaceAttend2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Form.setWindowIcon(icon)
        self.Calculate()
        low = QBarSet("Short")
        high = QBarSet("Clear")
        soshort = QBarSet("So Short")

        low << self.Low[0] << self.Low[1] << self.Low[2] << self.Low[3] << self.Low[4] << self.Low[5] << self.Low[6]
        soshort << self.SoShort[0] << self.SoShort[1] << self.SoShort[2] << self.SoShort[3] << self.SoShort[4] << self.SoShort[5] << self.SoShort[6]
        # high <<40 << -50 << -45.3 << -37.0 << -25.6 << -8.0 << -6.0
        high << self.High[0] << self.High[1] << self.High[2] << self.High[3] << self.High[4] << self.High[5] << self.High[6]

        series = QStackedBarSeries()
        series.append(low)
        series.append(high)
        series.append(soshort)

        chart = QChart()
        chart.addSeries(series)
        chart.setTitle("Attendance Graph")
        chart.setAnimationOptions(QChart.SeriesAnimations)

        categories = [self.Subjects[0],self.Subjects[1],self.Subjects[2],self.Subjects[3],self.Subjects[4],self.Subjects[5],self.Subjects[6]]

        axis = QBarCategoryAxis()
        axis.append(categories)
        axis.setTitleText("Month")
        chart.createDefaultAxes()
        chart.setAxisX(axis, series)
        chart.axisY(series).setRange(0, 100)
        chart.axisY(series).setTitleText("Percentage (%)")

        chart.legend().setVisible(True)
        chart.legend().setAlignment(Qt.AlignBottom)

        chartView = QChartView(chart)
        Form.setCentralWidget(chartView)
Beispiel #9
0
class VLineChartView(QChartView):

    bar_hovered = pyqtSignal(bool, str)

    def __init__(self, data: pd.DataFrame):
        super(VLineChartView, self).__init__()
        self._stocks = data
        self._category = self._stocks['trade_date']
        self._chart = QChart()
        self._chart.setAnimationOptions(QChart.SeriesAnimations)
        self._series = QStackedBarSeries()
        # 成交量以万股为单位
        self._vol_multiple = 10000
        self.init_chart()
        self._zero_value = (0, self._chart.axisY().min())
        self._max_value = (len(self._chart.axisX().categories()),
                           self._chart.axisY().max())
        self._zero_point = self._chart.mapToPosition(
            QPointF(self._zero_value[0], self._zero_value[1]))
        self._max_point = self._chart.mapToPosition(
            QPointF(self._max_value[0], self._max_value[1]))
        # 计算x轴单个cate的宽度,用来处理横线不能画到边界
        self._cate_width = (self._max_point.x() - self._zero_point.x()) / len(
            self._category)
        self._series.hovered.connect(self.on_series_hovered)

        x_index_list = np.percentile(range(len(self._category)),
                                     [0, 25, 50, 75, 100])
        self._x_axis_list = [
            QGraphicsSimpleTextItem(self._category[int(index)], self._chart)
            for index in x_index_list
        ]
        [axis.setText(axis.text()[4:]) for axis in self._x_axis_list[1:]]
        self._v_b = QGraphicsSimpleTextItem('B', self._chart)
        self._v_b.setZValue(100)

    def on_series_hovered(self, status, index):
        self.bar_hovered.emit(status, self._category[index])

    def clear_series_value(self):
        self._series.clear()
        self._stocks = None
        self._chart.axisY().setRange(0, 10)
        self._chart.axisX().setCategories(list())

    def add_series_values(self, data: pd.DataFrame, is_init=False):
        self._stocks = data
        bar_red = QBarSet('red')
        bar_red.setColor(Qt.red)
        bar_green = QBarSet('green')
        bar_green.setColor(Qt.green)
        for _, stock in self._stocks.iterrows():
            if stock['open'] < stock['close']:
                bar_red.append(stock['vol'] / self._vol_multiple)
                bar_green.append(0)
            else:
                bar_red.append(0)
                bar_green.append(stock['vol'] / self._vol_multiple)

        self._series.append(bar_red)
        self._series.append(bar_green)

        if not is_init:
            self._stocks = data
            self._category = self._stocks['trade_date']
            axis_x = self._chart.axisX()
            axis_y = self._chart.axisY()
            axis_x.setCategories(self._category)
            max_p = self._stocks[[
                'vol',
            ]].stack().max()
            min_p = self._stocks[[
                'vol',
            ]].stack().min()
            axis_y.setRange(min_p / self._vol_multiple * 0.9,
                            max_p / self._vol_multiple * 1.1)
            self._zero_value = (0, self._chart.axisY().min())
            self._max_value = (len(self._chart.axisX().categories()),
                               self._chart.axisY().max())
            # 计算x轴单个cate的宽度,用来处理横线不能画到边界
            self._cate_width = (self._max_point.x() -
                                self._zero_point.x()) / len(self._category)

    def resizeEvent(self, event):
        super(VLineChartView, self).resizeEvent(event)
        self._zero_point = self._chart.mapToPosition(
            QPointF(self._zero_value[0], self._zero_value[1]))
        self._max_point = self._chart.mapToPosition(
            QPointF(self._max_value[0], self._max_value[1]))
        self._cate_width = (self._max_point.x() - self._zero_point.x()) / len(
            self._category)
        # 绘制自定义X轴
        self._x_axis_list[0].setPos(self._zero_point.x() - self._cate_width,
                                    self._zero_point.y() + 10)
        self._x_axis_list[1].setPos(self._max_point.x() * 0.25,
                                    self._zero_point.y() + 10)
        self._x_axis_list[2].setPos(self._max_point.x() * 0.5,
                                    self._zero_point.y() + 10)
        self._x_axis_list[3].setPos(self._max_point.x() * 0.75,
                                    self._zero_point.y() + 10)
        self._x_axis_list[4].setPos(
            self._max_point.x() - self._x_axis_list[-1].boundingRect().width(),
            self._zero_point.y() + 10)
        # 20180207 这个日期的柱形图上面画一个字母b
        vol = self._stocks[self._stocks['trade_date'] ==
                           '20180207']['vol'] / self._vol_multiple
        print('vol:', vol, ' trade_date:', '20180207')
        pos = self._chart.mapToPosition(
            QPointF(list(self._category).index('20180207'), vol))
        pos = QPointF(pos.x() - self._cate_width / 2,
                      pos.y() - self._v_b.boundingRect().height())
        self._v_b.setPos(pos)

    def max_point(self):
        return QPointF(self._max_point.x() + self._cate_width / 2,
                       self._max_point.y())

    def min_point(self):
        return QPointF(self._zero_point.x() - self._cate_width / 2,
                       self._zero_point.y())

    def init_chart(self):
        self.add_series_values(self._stocks, True)
        self._chart.addSeries(self._series)
        self._chart.createDefaultAxes()
        self._chart.setLocalizeNumbers(True)
        axis_x = self._chart.axisX()
        axis_y = self._chart.axisY()
        axis_x.setGridLineVisible(False)
        axis_y.setGridLineVisible(False)
        axis_y.setLabelFormat("%.2f")
        axis_x.setCategories(self._category)
        axis_x.setLabelsVisible(False)
        max_p = self._stocks[[
            'vol',
        ]].stack().max()
        min_p = self._stocks[[
            'vol',
        ]].stack().min()
        axis_y.setRange(min_p / self._vol_multiple * 0.9,
                        max_p / self._vol_multiple * 1.1)

        # chart的图例
        legend = self._chart.legend()
        legend.hide()
        # 设置图例由Series来决定样式
        # legend.setMarkerShape(QLegend.MarkerShapeFromSeries)

        self.setChart(self._chart)
        self._chart.layout().setContentsMargins(0, 0, 0, 0)
        # 设置内边界的bottom为0
        # margins = self._chart.margins()
        # self._chart.setMargins(QMargins(margins.left(), 0, margins.right(), 0))
        self._chart.setBackgroundRoundness(0)
    def plotgraph(self):
        print(self.button_group.checkedButton().text())
        collection_name = self.button_group.checkedButton().text()
        mycol = mydb[collection_name]
        font = QtGui.QFont()
        font.setPointSize(9)

        ############### Query from the SKU(collection) for total number of good/bad count ##############

        global y1,y2,y3,y4,y5,y6,y7,y8,z1,z2,z3,z4,z5,z6,z7,z8
        ls0 =[]
        myquery0 = {"Status": "Bad", "SKU id":"S1" }
        for x in mycol.find(myquery0):
            ls0.append(x)
        y1 = len(ls0)

        ls1 =[]
        myquery1 = {"Status": "Good", "SKU id":"S1" }
        for x in mycol.find(myquery1):
            ls1.append(x)
        z1 = len(ls1)


        ls2 =[]
        myquery2 = {"Status": "Bad", "SKU id":"S2" }
        for x in mycol.find(myquery2):
            ls2.append(x)
        y2 = len(ls2)

        ls3 =[]
        myquery3 = {"Status": "Good", "SKU id":"S2" }
        for x in mycol.find(myquery3):
            ls3.append(x)
        z2 = len(ls3)


        ls4 =[]
        myquery4 = {"Status": "Bad", "SKU id":"S3" }
        for x in mycol.find(myquery4):
            ls4.append(x)
        y3 = len(ls4)

        ls5 =[]
        myquery5 = {"Status": "Good", "SKU id":"S3" }
        for x in mycol.find(myquery5):
            ls5.append(x)
        z3 = len(ls5)


        ls6 =[]
        myquery6 = {"Status": "Bad", "SKU id":"S4" }
        for x in mycol.find(myquery6):
            ls6.append(x)
        y4 = len(ls6)

        ls7 =[]
        myquery7 = {"Status": "Good", "SKU id":"S4" }
        for x in mycol.find(myquery7):
            ls7.append(x)
        z4 = len(ls7)


        ls8 =[]
        myquery8 = {"Status": "Bad", "SKU id":"S5" }
        for x in mycol.find(myquery8):
            ls8.append(x)
        y5 = len(ls8)

        ls9 =[]
        myquery9 = {"Status": "Good", "SKU id":"S5" }
        for x in mycol.find(myquery9):
            ls9.append(x)
        z5 = len(ls9)


        ls10 =[]
        myquery10 = {"Status": "Bad", "SKU id":"S6" }
        for x in mycol.find(myquery10):
            ls10.append(x)
        y6 = len(ls10)

        ls11 =[]
        myquery11 = {"Status": "Good", "SKU id":"S6" }
        for x in mycol.find(myquery11):
            ls11.append(x)
        z6 = len(ls11)


        ls12 =[]
        myquery12 = {"Status": "Bad", "SKU id":"S7" }
        for x in mycol.find(myquery12):
            ls12.append(x)
        y7 = len(ls12)

        ls13 =[]
        myquery13 = {"Status": "Good", "SKU id":"S7" }
        for x in mycol.find(myquery13):
            ls13.append(x)
        z7 = len(ls13)


        ls14 =[]
        myquery14 = {"Status": "Bad", "SKU id":"S8" }
        for x in mycol.find(myquery14):
            ls14.append(x)
        y8 = len(ls14)

        ls15 =[]
        myquery15 = {"Status": "Good", "SKU id":"S8" }
        for x in mycol.find(myquery15):
            ls15.append(x)
        z8 = len(ls15)

        self.clearLayout(lay)
        #########################################################################
        set0 = QBarSet("Good")
        set1 = QBarSet("Bad")
            
        # set0.append([5400, 4900, 5100, 5400, 5000, 4800, 4500, 3000])
        # set1.append([600, 800, 900, 600, 1000, 1200, 1500, 3000])
        set0.append([z1,z2,z3,z4,z5,z6,z7,z8])
        set1.append([y1,y2,y3,y4,y5,y6,y7,y8])

        series = QStackedBarSeries()
        series.append(set0)
        series.append(set1)
        
        chart = QChart()
        chart.addSeries(series)
        chart.setTitle("Production Count")
        chart.setAnimationOptions(QChart.SeriesAnimations)
            
        categories = ["12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00"]
        axis = QBarCategoryAxis()
        axis.append(categories)
        chart.createDefaultAxes()
        chart.setAxisX(axis, series)

        axisY = QValueAxis()
        axisY.setRange(0, 6000)
        axisY.setTitleText("Units")
        chart.setAxisY(axisY)

        chart.legend().setVisible(True)
        chart.legend().setAlignment(Qt.AlignBottom)

        chartView = QChartView(chart)
        chartView.setRenderHint(QPainter.Antialiasing)
        chartView.setToolTip('Good Units v/s Bad Units')

        comboBox = QtWidgets.QComboBox()
        comboBox.setGeometry(QtCore.QRect(20, 20, 171, 31))
        comboBox.setObjectName("comboBox")
        comboBox.addItem("SKU Selection")
        comboBox.addItem("Analytics View")
        comboBox.activated[str].connect(self.bargraph)
        comboBox.setToolTip("Select an Option!")    # Message to show when mouse hover
        comboBox.setFont(font)

        lay.addWidget(comboBox,0)
        lay.addWidget(chartView,1)
    def bargraph(self, text):
        if text == "SKU Selection":
            # print("sku")
            self.clearLayout(lay)
            font = QtGui.QFont()
            font.setPointSize(9)

            comboBox = QtWidgets.QComboBox()
            comboBox.setGeometry(QtCore.QRect(20, 20, 171, 31))
            comboBox.setObjectName("comboBox")
            comboBox.addItem("SKU Selection")
            comboBox.addItem("Analytics View")
            comboBox.activated[str].connect(self.bargraph)
            comboBox.setToolTip("Select an Option!")    # Message to show when mouse hover
            comboBox.setFont(font)
            lay.addWidget(comboBox,0,Qt.AlignTop)

            self.dynamicaly_created_radiobtns()

        else:
            # print("analytics")
            try:
                self.clearLayout(lay)
                font = QtGui.QFont()
                font.setPointSize(9)
                
                set0 = QBarSet("Good")
                set1 = QBarSet("Bad")
                # set0.append([5400, 4900, 5100, 5400, 5000, 4800, 4500, 3000])
                # set1.append([600, 800, 900, 600, 1000, 1200, 1500, 3000])

                set0.append([z1,z2,z3,z4,z5,z6,z7,z8])
                set1.append([y1,y2,y3,y4,y5,y6,y7,y8])

                series = QStackedBarSeries()
                series.append(set0)
                series.append(set1)

                chart = QChart()
                chart.addSeries(series)
                chart.setTitle("Production Count")
                chart.setAnimationOptions(QChart.SeriesAnimations)

                categories = ["12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00"]
                axis = QBarCategoryAxis()
                axis.append(categories)
                chart.createDefaultAxes()
                chart.setAxisX(axis, series)

                axisY = QValueAxis()
                axisY.setRange(0, 6000)
                axisY.setTitleText("Units")
                chart.setAxisY(axisY)

                chart.legend().setVisible(True)
                chart.legend().setAlignment(Qt.AlignBottom)

                chartView = QChartView(chart)
                chartView.setRenderHint(QPainter.Antialiasing)
                chartView.setToolTip('Good Units v/s Bad Units')

                comboBox = QtWidgets.QComboBox()
                comboBox.setGeometry(QtCore.QRect(20, 20, 171, 31))
                comboBox.setObjectName("comboBox")
                comboBox.addItem("SKU Selection")
                comboBox.addItem("Analytics View")
                comboBox.activated[str].connect(self.bargraph)
                comboBox.setToolTip("Select an Option!")    # Message to show when mouse hover
                comboBox.setFont(font)

                lay.addWidget(comboBox,0)
                lay.addWidget(chartView,1)
            
            except:

                self.clearLayout(lay)
                font = QtGui.QFont()
                font.setPointSize(9)
                
                set0 = QBarSet("Good")
                set1 = QBarSet("Bad")           
                # set0.append([5400, 4900, 5100, 5400, 5000, 4800, 4500, 3000])
                # set1.append([600, 800, 900, 600, 1000, 1200, 1500, 3000])

                set0.append([0,0,0,0,0,0,0,0])
                set1.append([0,0,0,0,0,0,0,0])

                series = QStackedBarSeries()
                series.append(set0)
                series.append(set1)
        
                chart = QChart()
                chart.addSeries(series)
                chart.setTitle("Production Count")
                chart.setAnimationOptions(QChart.SeriesAnimations)
                
                categories = ["12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00"]
                axis = QBarCategoryAxis()
                axis.append(categories)
                chart.createDefaultAxes()
                chart.setAxisX(axis, series)

                axisY = QValueAxis()
                axisY.setRange(0, 6000)
                axisY.setTitleText("Units")
                chart.setAxisY(axisY)

                chart.legend().setVisible(True)
                chart.legend().setAlignment(Qt.AlignBottom)

                chartView = QChartView(chart)
                chartView.setRenderHint(QPainter.Antialiasing)
                chartView.setToolTip('Good Units v/s Bad Units')
                
                comboBox = QtWidgets.QComboBox()
                comboBox.setGeometry(QtCore.QRect(20, 20, 171, 31))
                comboBox.setObjectName("comboBox")
                comboBox.addItem("SKU Selection")
                comboBox.addItem("Analytics View")
                comboBox.activated[str].connect(self.bargraph)
                comboBox.setToolTip("Select an Option!")    # Message to show when mouse hover
                comboBox.setFont(font)

                lay.addWidget(comboBox,0)
                lay.addWidget(chartView,1)

                msgBox = QMessageBox(self)
                msgBox.setIcon(QMessageBox.Information)
                msgBox.setText("Please Select a SKU!")
                msgBox.setWindowTitle("Application Info")
                msgBox.setStandardButtons(QMessageBox.Ok)
                returnValue = msgBox.exec()
                if returnValue == QMessageBox.Ok:
                    print('OK clicked')