Given three arrays (daily sales of product A, daily sales of product B, daily sales targets), return a string representing a stacked column chart of the total sales (with targets) for each day of the week.
columnChart([30, 20, 10, 30, 10, 20, 10], [20, 10, 10, 10, 20, 0, 10], [50, 40, 20, 40, 30, 30, 40]))
➞ "60 | __ |\n50 | ** __ __ __ |\n40 | ** ** __ __ |\n30 | ++ ** __ ++ ** |\n20 | ++ ++ ** ++ ** ++ ** |\n10 | ++ ++ ++ ++ ++ ++ ++ |\n | Mo Tu We Th Fr Sa Su |"
By day:
Mo Tu We Th Fr Sa Su
productA = [30, 20, 10, 30, 10, 20, 10]
productB = [20, 10, 10, 10, 20, 0, 10]
target = [50, 40, 20, 40, 30, 30, 40]
When printed:
60 | __ |
50 | ** __ __ __ |
40 | ** ** __ __ |
30 | ++ ** __ ++ ** |
20 | ++ ++ ** ++ ** ++ ** |
10 | ++ ++ ++ ++ ++ ++ ++ |
| Mo Tu We Th Fr Sa Su |
Be careful when placing the target underscores. Although the Monday target is 50 in the example above, the underscore is placed on the row where sales equal 60).