         color = dataset.color
 
         if paths and paths.length
-            @drawPaths(datasetElement, dataset, paths)
+            @drawPaths(dataset.element, dataset, paths)
         else if records and records.length
             points = dataset.getRecords().filter((record) =>
                 (@scales.x(new Date(record[1])) - @scales.x(new Date(record[0]))) < 5

            source: definition.source,
            records: definition.records,
            lineplot: lineplot,
            debounceTime: @options.debounce
        })
        
        
        @reloadDataset(id)

    # remove a dataset. redraws.

            ranges = dataset.getRecords().filter((record) =>
                (@scales.x(new Date(record[1])) - @scales.x(new Date(record[0]))) >= 5
            )
            @drawRanges(dataset.element, dataset, ranges)
            @drawPoints(dataset.element, dataset, points)

    # this function triggers the reloading of a dataset (sync)

