Browse Source

Cap right axis labels in previous year production comparison to 20

Neal Wilson 9 years ago
parent
commit
5894cf9bfd
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      config/Reports/chart.xml

+ 8
- 3
config/Reports/chart.xml View File

162
                     query.exec(q);
162
                     query.exec(q);
163
                     if(query.next())
163
                     if(query.next())
164
                     {
164
                     {
165
-                        curpounds[i] = query.value(0);
165
+                        curpounds[i] = Number(query.value(0));
166
                     }
166
                     }
167
                     else
167
                     else
168
                     {
168
                     {
172
                     query.exec(q);
172
                     query.exec(q);
173
                     if(query.next())
173
                     if(query.next())
174
                     {
174
                     {
175
-                        prevpounds[i] = query.value(0);
175
+                        prevpounds[i] = Number(query.value(0));
176
                     }
176
                     }
177
                     else
177
                     else
178
                     {
178
                     {
347
                     i += increment;
347
                     i += increment;
348
                 }
348
                 }
349
                 i = miny2;
349
                 i = miny2;
350
+                var stepSize = 0.1;
351
+                while((maxy2 - miny2) / stepSize > 20)
352
+                {
353
+                    stepSize += 0.05;
354
+                }
350
                 while(i <= maxy2)
355
                 while(i <= maxy2)
351
                 {
356
                 {
352
                     output.writeStartElement("text");
357
                     output.writeStartElement("text");
355
                     output.writeAttribute("font-size", "12");
360
                     output.writeAttribute("font-size", "12");
356
                     output.writeCharacters(Number(i*100).toFixed(0)+"%");
361
                     output.writeCharacters(Number(i*100).toFixed(0)+"%");
357
                     output.writeEndElement();
362
                     output.writeEndElement();
358
-                    i += 0.1;
363
+                    i += stepSize;
359
                 }
364
                 }
360
                 i = 0;
365
                 i = 0;
361
                 while(i <= days-1)
366
                 while(i <= days-1)

Loading…
Cancel
Save