Skip to content

Commit

Permalink
Convert chartscii.ts to chartscii.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tool3 committed Jun 10, 2024
1 parent 22574e2 commit 64f6a55
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions chartscii.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from formatters.horizontal import HorizontalChartFormatter
from formatters.vertical import VerticalChartFormatter
from processor.processor import ChartProcessor
from options.options import Options
from types.types import InputData, ChartOptions, ChartData, CustomizationOptions

class Chartscii:
def __init__(self, data: list[InputData], options: CustomizationOptions = None):
config = Options(options)
processor = ChartProcessor(config)
chart, processed_options = processor.process(data)

self.chart = chart
chart_formatter = VerticalChartFormatter(chart, processed_options) if config.orientation == 'vertical else HorizontalChartFormatter(processed_options)

self.ascii_chart = chart_formatter.format(self.chart)

def create(self):
return self.ascii_chart

0 comments on commit 64f6a55

Please sign in to comment.