def test1_timeseries(self, boreholeno, compound, datefrom, dateto):
        """ Based of matplotlib.plot_date
            TEST: No use of ax - one borehole multiple compounds
        """
        # Here we just use one figure
        plt.figure(1)

        db = JupiterDb()

        # Test compound - overwrites gui input
        compound = 'Nitrat; Sulfat'

        compounds = compound.split(';')
        for c in compounds:
            amount, dt = db.get_timeserie(boreholeno, c.strip(), datefrom,
                                          dateto)
            if amount is None:
                return False

            dt = dates.date2num(dt)
            plt.plot_date(dt, amount, linestyle='-', label=c)

        plt.xticks(rotation='vertical')
        plt.title('{}-tidsserie for boring: {}'.format(compound, boreholeno))

        plt.legend(loc='upper center', shadow=True)
        plt.grid(True)

        plt.show()

        return True
    def timeseries_oneborehole_multiplecompounds(self,
                                                 boreholeno,
                                                 compoundlist,
                                                 datefrom,
                                                 dateto,
                                                 skip_unit=False,
                                                 progress=None):
        """ Based of matplotlib.plot_date
             Multiple compounds and one borehole
         """
        # General Figure
        plt.figure(1)
        fig = plt.figure(1)
        plt.subplots_adjust(left=0.1, right=0.9, top=0.9, bottom=0.15)

        # General Axis
        ax = fig.add_subplot(1, 1, 1)

        # X-Axis
        ax.set_xlabel(u'År')

        # Y-Axis
        ax.set_ylabel('Koncentration')
        ax.yaxis.grid()

        db = JupiterDb()
        compounds = compoundlist.split(';')

        not_found = []
        compound_index = 0
        for c in compounds:
            compound_index += 1
            if progress is not None:
                progress.setPercentage(compound_index * 100 / len(compounds))
            c = c.strip()
            # Get amount and dates for compound
            amount, dt = db.get_timeserie(boreholeno, c, datefrom, dateto)
            if amount is None:
                not_found.append(c)
                if len(compounds) == 1:
                    return False, None
                else:
                    continue

            if skip_unit:
                label_legend = c
            else:
                # Get unit for legend label - time consuming part
                unit_tuple_list = db.count_compound_units(c)
                if unit_tuple_list is None:
                    # No unit for compound - not likely
                    label_legend = '{} [???]'.format(c)
                else:
                    if len(unit_tuple_list) == 1:
                        # Perfect - just one unit for compound
                        unit_count, unit = unit_tuple_list[0]
                        label_legend = '{} [{}]'.format(c, unit)
                    elif len(unit_tuple_list) > 1:
                        # More than one unit pr compound
                        units = []
                        for unit_count, unit in unit_tuple_list:
                            units.append('{}?'.format(unit))
                        label_legend = '{} [{}]'.format(c, ' '.join(units))

            # Convert datetime to matplot numbers
            dt = dates.date2num(dt)
            plt.plot_date(dt,
                          amount,
                          linestyle='-',
                          markersize=3,
                          label=label_legend)

        plt.xticks(rotation='vertical')
        plt.title('Tidsserie for boring: {}'.format(boreholeno))
        plt.legend(loc='upper center', shadow=True)

        plt.show()

        return True, not_found
    def timeseries_onecompound_multipleborehole(self,
                                                boreholenolist,
                                                compound,
                                                datefrom,
                                                dateto,
                                                progress=None):
        """ Based of matplotlib.plot_date. Multiple borehole and one compound """

        from datetime import datetime

        def onclick(event):
            JupiterAux.msg_box(
                '%s click: button=%d, x=%d, y=%d, xdata=%f, ydata=%f' %
                ('double' if event.dblclick else 'single', event.button,
                 event.x, event.y, event.xdata, event.ydata))

        def onpick(event):
            thisline = event.artist
            borehole_graph_pick = thisline.get_label()

            #JupiterAux.msg_box('Picked borehole graph: {}'.format(borehole_graph_pick))

            #xdata = thisline.get_xdata()  #convert to  dates.num2date(dt)
            #ydata = thisline.get_ydata()
            #ind = event.ind
            #points = tuple(zip(xdata[ind], ydata[ind]))
            #JupiterAux.msg_box('{} - onpick points: {}'.format(borehole_graph_selection, points))

            qgis = JupiterQGIS()
            qgis.add_vertexmarker_borehole(borehole_graph_pick)

        # General Figure
        plt.figure(1)
        fig = plt.figure(1)
        plt.subplots_adjust(left=0.1, right=0.75, top=0.9, bottom=0.15)

        #cid = fig.canvas.mpl_connect('button_press_event', onclick)
        cid = fig.canvas.mpl_connect('pick_event', onpick)

        # General Axis
        ax = fig.add_subplot(1, 1, 1)

        # Draw compound limit as a horizontal line
        #plt.axhline(y=2.7)  only relevant for drwplant, no boreholes

        # X-Axis
        ax.set_xlabel(u'År')

        # Y-Axis - get unit of compound
        db = JupiterDb()
        unit_tuple_list = db.count_compound_units(compound)
        ax_ylabel = compound.title()
        if unit_tuple_list is None:
            # No unit for compound - not likely
            ax_ylabel += u' [???]'
            JupiterAux.msg_box(
                u'Bemærk der findes ingen enhed for stoffet: {} i PCJupiterXL'.
                format(compound))
        else:
            if len(unit_tuple_list) == 1:
                # Perfect - just one unit for compound
                unit_count, unit = unit_tuple_list[0]
                ax_ylabel += u' [{}]'.format(unit)
            elif len(unit_tuple_list) > 1:
                # More than one unit pr compound
                units = []
                for unit_count, unit in unit_tuple_list:
                    units.append(u'{}?'.format(unit))

                ax_ylabel = u' [{}]'.format(' '.join(units))
                JupiterAux.msg_box(
                    u'Bemærk stoffet: {} har flere enheder: ({}) i PCJupiterXL'
                    .format(compound, ', '.join(units)))

        ax.set_ylabel(ax_ylabel)

        ax.yaxis.grid()

        boreholes = boreholenolist.split(',')
        not_found = []
        borehole_index = 0

        for b in boreholes:
            borehole_index += 1

            if progress is not None:
                progress.setPercentage(borehole_index * 100 / len(boreholes))

            b = b.strip()

            # Get amount and dates for compound and boreholes
            amount, dt = db.get_timeserie(b, compound, datefrom, dateto)
            if amount is None:
                not_found.append(b)
                if len(boreholes) == 1:
                    return False, None
                else:
                    continue

            # Convert datetime to matplot numbers
            dt = dates.date2num(dt)
            plt.plot_date(dt,
                          amount,
                          linestyle='-',
                          markersize=3,
                          label=b,
                          picker=5)

        plt.xticks(rotation='vertical')
        plt.title('Tidsserie')
        plt.legend(bbox_to_anchor=(1.02, 1),
                   loc=2,
                   borderaxespad=0.,
                   shadow=True)

        plt.show()

        return True, not_found