22 lines
618 B
Python
22 lines
618 B
Python
from chart import Chart
|
|
from pandas import Series
|
|
from plotly.graph_objects import Scatter
|
|
from typing import List
|
|
|
|
class LineChart(Chart):
|
|
|
|
def __init__(self, x: Series, values: List[Series], title: str = ''):
|
|
self.x = x
|
|
self.values = values
|
|
self.title = title
|
|
|
|
def traces(self) -> List[Scatter]:
|
|
traces = []
|
|
for value in self.values:
|
|
traces.append(Scatter(
|
|
x = self.x,
|
|
y = value,
|
|
mode = 'lines',
|
|
line=dict(color = 'yellow') # TODO: Make this configurable.
|
|
))
|
|
return traces |