Programming My Own Trading Chart - Part 12

avatar

TradeX - Chart

I've had tough nut of problem to crack. I'm not a genius programmer, but I am persistent. This particular problem has been challenging for others, and it would seem, not many others have solved it.

The challenge in question is the chart time line. Date and time handling for anything computer related, has it's quirks, but how hard can it be?

Judging from a number of other trade chart components out there, only a few have gone the distance to solve it.

Difficulties arise when you want to divide the timeline up into nice even segments. This is straight forward on time scales lower than a day, because time units are regular, being fixed. 1000 milliseconds in a second, 60 seconds in a minute, sixty minutes in an hour, 24 hours in a day.

But then along comes calendar dates, where each month has a different number of days, and spice things up further, we have leap years.

While the chart might be displaying say a one hour time frame, where you'll of course be displaying hours, it would be nice to see also when a day begins. But what then if that day happens to be the first? That means displaying a month name. Then along comes the first of January, which of course is the start of a new year. Displaying these nicely, and evenly as possible positioned amongst the lower time frames is where the challenge starts.

Why not copy and paste from the other open source projects? Well that has challenges and issues of its own, especially when getting down into such low level mechanics of a trade chart web component. Doing so would often mean having to implement much more of their code. So it is often best to attempt to decode what they've done and write your own implementation.

I had to examine multiple projects before I could identify commonalities. This allowed me to correct the fundamentals in my own second attempt I had written. But now I could go a step further and tease out the solution to the tough nut.

I'm yet to polish up my final solution, but the gist of it is there. Importantly it works.

When I clean up some of the new bugs I've introduced elsewhere I finally be able to push the next release. It's been some months and I guess for those who had initial interest, they think the project is dead after the previous regular updates.

Sometimes programming is too all consuming and I have to balance things out and get other things done, otherwise I spend too much time staring a computer screens, debugging code and feeling frustrated because there is no progress to show.

I'm working on finding that balance.

Posted Using LeoFinance Beta



0
0
0.000
1 comments