-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert chartscii.ts to chartscii.py
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |