Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_x_y_values(df, encoding):
try:
x_values, y_values = GraphBase._get_x_y_values_aggregated(df,
encoding.x,
encoding.y,
encoding.y_aggregation)
except ValueError:
x_values = GraphBase._get_x_values(df, encoding)
y_values = GraphBase._get_y_values(df, encoding)
return x_values, y_values
def _get_x_values_labels(df, encoding):
if encoding.y is None:
series = df.groupby([encoding.x]).size()
values = series.values.tolist()
labels = series.index.tolist()
else:
labels, values = GraphBase._get_x_y_values(df, encoding)
return values, labels
# Copyright (c) 2015 aggftw@gmail.com
# Distributed under the terms of the Modified BSD License.
from plotly.graph_objs import Bar
from .graphbase import GraphBase
class BarGraph(GraphBase):
def _get_data(self, df, encoding):
x_values, y_values = GraphBase._get_x_y_values(df, encoding)
return [Bar(x=x_values, y=y_values)]
# Copyright (c) 2015 aggftw@gmail.com
# Distributed under the terms of the Modified BSD License.
from plotly.graph_objs import Scatter
from .graphbase import GraphBase
class LineGraph(GraphBase):
def _get_data(self, df, encoding):
x_values, y_values = GraphBase._get_x_y_values(df, encoding)
return [Scatter(x=x_values, y=y_values)]
def _get_data(self, df, encoding):
x_values, y_values = GraphBase._get_x_y_values(df, encoding)
return [Scatter(x=x_values, y=y_values)]
def _get_x_y_values(df, encoding):
try:
x_values, y_values = GraphBase._get_x_y_values_aggregated(df,
encoding.x,
encoding.y,
encoding.y_aggregation)
except ValueError:
x_values = GraphBase._get_x_values(df, encoding)
y_values = GraphBase._get_y_values(df, encoding)
return x_values, y_values
def _get_data(self, df, encoding):
x_values, y_values = GraphBase._get_x_y_values(df, encoding)
return [Bar(x=x_values, y=y_values)]
def _get_x_y_values(df, encoding):
try:
x_values, y_values = GraphBase._get_x_y_values_aggregated(df,
encoding.x,
encoding.y,
encoding.y_aggregation)
except ValueError:
x_values = GraphBase._get_x_values(df, encoding)
y_values = GraphBase._get_y_values(df, encoding)
return x_values, y_values
from plotly.graph_objs import Scatter
from .graphbase import GraphBase
class ScatterGraph(GraphBase):
def _get_data(self, df, encoding):
x_values, y_values = GraphBase._get_x_y_values(df, encoding)
return [Scatter(x=x_values, y=y_values, mode='markers')]
def _get_data(self, df, encoding):
x_values, y_values = GraphBase._get_x_y_values(df, encoding)
return [Scatter(x=x_values, y=y_values, fill="tonexty")]