196
197
sn.day_high = 0 //Re-using this varible here
197
198
sn.day_low = 0 //Re-using this varible here
198
199
sn.day_close = 0//Re-using this varible here
199
var day_open = 0, text_pos = 1, date_text = ""
201
if ( this.past_len > 90 ) // This needs to divide by screen width
202
date_text = this.listModel.get(this.past_len).date.split('-')[1]+"/"+this.listModel.get(this.past_len).date.split('-')[2]+"/"+this.listModel.get(this.past_len).date.split('-')[0].substr(2)
203
else date_text = this.listModel.get(this.past_len).date.split('-')[2]
200
var day_open = 0, text_pos = 0, date_text = ""
202
var oneShot = false, dateSpacing, dateTextLength, dateFormat = ''
204
var dateArray = this.listModel.get(this.past_len).date.split('-')
205
if ( parseInt(dateArray[1]) < parseInt(new Date().getMonth()) ) // This will find if the chart goes back from this month and year for text display
207
if ( parseInt(dateArray[0]) < parseInt(new Date().getFullYear()) )
206
210
var xv = this.graph.options.leftPadding, ff = false
207
for ( var i = this.past_len; i >= 1; i-- ) {
218
this.graph.ctx.beginPath()
219
xv = this.graph.options.leftPadding
220
this.graph.ctx.moveTo(xv, this.graph.options.height-this.volume_size-graph_bottom )
222
for ( var i = this.past_len; i >= 0; i-- ) {
225
if ( !ff ) ff = (this.graph.options.height-this.volume_size-graph_bottom)-(parseFloat(this.listModel.get(i).close-this.min_value)*this.value_adjust).toFixed(2)
226
ff = (this.graph.options.height-this.volume_size-graph_bottom)-(parseFloat(this.listModel.get(i).close-this.min_value)*this.value_adjust).toFixed(2)
228
this.graph.ctx.lineTo(xv, ff )
229
this.graph.ctx.strokeStyle = this.chartLineColor
230
this.graph.ctx.stroke();
231
// ----------------------------
232
xv += this.space_average
235
this.graph.ctx.lineTo(xv-this.space_average, this.graph.options.height-this.volume_size-graph_bottom )
237
this.graph.ctx.stroke()
239
if ( this.graph.options.showDayRange !== "yes" ) {
240
this.graph.ctx.closePath()
241
this.graph.ctx.fillStyle = this.graph.ctx.createLinearGradient(this.graph.options.width-this.graph.options.rightPadding, 0,
242
this.graph.options.width-this.graph.options.rightPadding, this.graph.options.height-this.volume_size-graph_bottom).addColorStop(0,"#A1A1A1").addColorStop(1,"#ededed")
243
this.graph.ctx.fill()
258
xv = this.graph.options.leftPadding
260
for ( var i = this.past_len; i >= 0; i-- ) {
209
262
day_open = parseFloat(this.listModel.get(i).open)
210
263
sn.day_close = parseFloat(this.listModel.get(i).close)
212
266
// Graph trade line
213
267
if ( !ff ) ff = (this.graph.options.height-this.volume_size-graph_bottom)-(parseFloat(this.listModel.get(i).close-this.min_value)*this.value_adjust).toFixed(2)
214
268
this.graph.ctx.beginPath()
253
309
// Graph bottom date text
254
310
this.graph.ctx.fillStyle = this.graph.options.dateTextColor
255
if ( text_pos > (date_text.length)*this.char_pixel_size && (i*this.space_average) > (date_text.length)*this.char_pixel_size && (i*this.space_average) > (date_text.length)*this.char_pixel_size ) {
257
if ( this.past_len > 90 )
258
date_text = this.listModel.get(i).date.split('-')[1]+"/"+this.listModel.get(i).date.split('-')[2]+"/"+this.listModel.get(i).date.split('-')[0].substr(2)
259
else date_text = this.listModel.get(i).date.split('-')[2]
260
this.graph.ctx.textBaseline = 'bottom'
261
this.graph.ctx.fillText(date_text, xv-((date_text.length*this.char_pixel_size)/2), this.graph.options.height)
312
dateArray = this.listModel.get(i).date.split('-')
314
date_text = dateArray[2].toString()
317
else if ( dateFormat === 'month' ) {
318
date_text = dateArray[1]+"/"+dateArray[2]
321
else if ( dateFormat === 'year' ) {
322
//date_text = this.listModel.get(i).date.split('-') // I wonder how thorough the gargage collection is in qt?
323
//date_text = date_text[1]+"/"+date_text[2]+"/"+date_text[0].substr(2)
324
date_text = dateArray[1]+"/"+dateArray[2]+"/"+dateArray[0].substr(2)
328
dateTextLength = date_text.length*this.char_pixel_size
329
if ( ( text_pos >= dateTextLength/4 && !oneShot ) || ( text_pos >= dateTextLength/2+dateSpacing && i*this.space_average > dateTextLength/4 ) ) {
332
this.graph.ctx.textBaseline = 'bottom'
333
this.graph.ctx.fillText(date_text, xv-dateTextLength/4, this.graph.options.height)
263
335
// ----------------------------
266
337
text_pos += this.space_average
267
338
xv += this.space_average
297
368
this.graph.ctx.stroke();
303
var graph = new Graph({topPadding: 20, rightPadding: 5, bottomPadding: 0, leftPadding: 5, middleLine: "yes", showDayRange: "no",
376
var graph = new Graph({topPadding: 20, rightPadding: 5, bottomPadding: 0, leftPadding: 5, middleLine: "no", showDayRange: "no",
304
377
dateTextColor: "#3D1D04", tradePointColor: "#434343", volumeLineColor: "#2C2832"