def _plot_single(self, data, name, display): series = to_series(dict(data=data, name=name)) series = set_display(series, display) to_json_files( series, self.path, )
def plotasync( series=None, options=dict(), type='line', height=400, save="temp", stock=False, show='tab', display=False, purge=False, live=False): """ :param type: Type of the chart. Can be line, area, spline, pie, bar, ... :param display: Set to true to display all, False to display none or an array of names for a specific selection :param purge: Set to true to clean the directory :param live: Set to true to keep the chart in sync with data in the directory. Currently only works for show='tab' :param series: The series object which contains the data. If this is not specified, the plot will look for json files in the save directory. :param options: The chart display options :param height: Height of the chart :param save: Name of the directory to store the data :param stock: Set to true to use highstock :param show: Determines how the chart is shown. Can be one of the following options: - 'tab': Show the chart in a new tab of the default browser - 'window': Show the chart in a new window of the default browser - 'inline': Show the chart inline (only works in IPython notebook) :return: A chart object """ try: if not options['chart']: options['chart'] = dict(type=type) except KeyError: options['chart'] = dict(type=type) if 'height' not in options: options['height'] = 400 # Clean the directory if purge: clean_dir(save) else: make_dir(save) if series is not None: # Convert to a legitimate series object series = to_series(series) series = set_display(series, display) # Convert to json files to_json_files(series, save) if show == 'inline': live = False with open(os.path.join(package_directory, "index-async.html"), "r") as index: read = index.read() html = MyTemplate(read).substitute( path=json.dumps('/' + save), options=json.dumps(options), highstock=json.dumps(stock), height=str(height) + "px", live=json.dumps(live), url=json.dumps(address), save=json.dumps(False) ) inline = MyTemplate(read).substitute( path=json.dumps(save), options=json.dumps(options), highstock=json.dumps(stock), height=str(height) + "px", live=json.dumps(live), url=json.dumps(address), save=json.dumps(False) ) html_path = os.path.join(save, 'index.html') with open(html_path, "w") as html_file: html_file.write(html + TABDEPS) return Chart(inline, html_path, save, show)
def plotasync(series=None, options=dict(), type='line', height=400, save="temp", stock=False, show='tab', display=False, purge=False, live=False): """ :param type: Type of the chart. Can be line, area, spline, pie, bar, ... :param display: Set to true to display all, False to display none or an array of names for a specific selection :param purge: Set to true to clean the directory :param live: Set to true to keep the chart in sync with data in the directory. Currently only works for show='tab' :param series: The series object which contains the data. If this is not specified, the plot will look for json files in the save directory. :param options: The chart display options :param height: Height of the chart :param save: Name of the directory to store the data :param stock: Set to true to use highstock :param show: Determines how the chart is shown. Can be one of the following options: - 'tab': Show the chart in a new tab of the default browser - 'window': Show the chart in a new window of the default browser - 'inline': Show the chart inline (only works in IPython notebook) :return: A chart object """ try: if not options['chart']: options['chart'] = dict(type=type) except KeyError: options['chart'] = dict(type=type) if 'height' not in options: options['height'] = 400 # Clean the directory if purge: clean_dir(save) else: make_dir(save) if series is not None: # Convert to a legitimate series object series = to_series(series) series = set_display(series, display) # Convert to json files to_json_files(series, save) if show == 'inline': live = False with open(os.path.join(package_directory, "index-async.html"), "r") as index: read = index.read() html = MyTemplate(read).substitute(path=json.dumps('/' + save), options=json.dumps(options), highstock=json.dumps(stock), height=str(height) + "px", live=json.dumps(live), url=json.dumps(address), save=json.dumps(False)) inline = MyTemplate(read).substitute(path=json.dumps(save), options=json.dumps(options), highstock=json.dumps(stock), height=str(height) + "px", live=json.dumps(live), url=json.dumps(address), save=json.dumps(False)) html_path = os.path.join(save, 'index.html') with open(html_path, "w") as html_file: html_file.write(html + TABDEPS) return Chart(inline, html_path, save, show)
def _plot_single(self, data, name, display): series = to_series(dict(data=data, name=name)) series = set_display(series, display) to_json_files(series, self.path, )
def _plot_multi(self, series, display): series = to_series(series) series = set_display(series, display) to_json_files(series, self.path)