I have 5 horizontal lines and each has a distance of 50 px. The first horizontal line should display the max value, the last the min value. Now I have an array with 4 items with different values. Basically I want show the LINES on the horizontal lines to show the chart.
var prices = [13000, 11000, 14000, 10000];
My "problem" is how I can add each item to the Horizontal Line? I can use something like this but it will be a lot of work and the other point is the values of "Prices" will be allways different. It can also has values like this:
[18510, 16020, 12300, 15190];
for (var i = 0; i < prices.length; i+) {
if (prices[i] >= 14000 && prices[i] < 14001) drawLine(x1, 150, x2, 150);
if (prices[i] >= 14001 && prices[i] < 14002) drawLine(x1, 149, x2, 149);
if (prices[i] >= 14002 && prices[i] < 14003) drawLine(x1, 148, x2, 148);
}
2
Answers
You need to determine these aspects.