defaults.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /**
  2. * Default configuration settings
  3. */
  4. getDefaults = function () {
  5. return {
  6. // Settings common to most/all chart types
  7. common: {
  8. type: 'line',
  9. lineColor: '#00f',
  10. fillColor: '#cdf',
  11. defaultPixelsPerValue: 3,
  12. width: 'auto',
  13. height: 'auto',
  14. composite: false,
  15. tagValuesAttribute: 'values',
  16. tagOptionsPrefix: 'spark',
  17. enableTagOptions: false,
  18. enableHighlight: true,
  19. highlightLighten: 1.4,
  20. tooltipSkipNull: true,
  21. tooltipPrefix: '',
  22. tooltipSuffix: '',
  23. disableHiddenCheck: false,
  24. numberFormatter: false,
  25. numberDigitGroupCount: 3,
  26. numberDigitGroupSep: ',',
  27. numberDecimalMark: '.',
  28. disableTooltips: false,
  29. disableInteraction: false
  30. },
  31. // Defaults for line charts
  32. line: {
  33. spotColor: '#f80',
  34. highlightSpotColor: '#5f5',
  35. highlightLineColor: '#f22',
  36. spotRadius: 1.5,
  37. minSpotColor: '#f80',
  38. maxSpotColor: '#f80',
  39. lineWidth: 1,
  40. normalRangeMin: undefined,
  41. normalRangeMax: undefined,
  42. normalRangeColor: '#ccc',
  43. drawNormalOnTop: false,
  44. chartRangeMin: undefined,
  45. chartRangeMax: undefined,
  46. chartRangeMinX: undefined,
  47. chartRangeMaxX: undefined,
  48. tooltipFormat: new SPFormat('<span style="color: {{color}}">&#9679;</span> {{prefix}}{{y}}{{suffix}}')
  49. },
  50. // Defaults for bar charts
  51. bar: {
  52. barColor: '#3366cc',
  53. negBarColor: '#f44',
  54. stackedBarColor: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00',
  55. '#dd4477', '#0099c6', '#990099'],
  56. zeroColor: undefined,
  57. nullColor: undefined,
  58. zeroAxis: true,
  59. barWidth: 4,
  60. barSpacing: 1,
  61. chartRangeMax: undefined,
  62. chartRangeMin: undefined,
  63. chartRangeClip: false,
  64. colorMap: undefined,
  65. tooltipFormat: new SPFormat('<span style="color: {{color}}">&#9679;</span> {{prefix}}{{value}}{{suffix}}')
  66. },
  67. // Defaults for tristate charts
  68. tristate: {
  69. barWidth: 4,
  70. barSpacing: 1,
  71. posBarColor: '#6f6',
  72. negBarColor: '#f44',
  73. zeroBarColor: '#999',
  74. colorMap: {},
  75. tooltipFormat: new SPFormat('<span style="color: {{color}}">&#9679;</span> {{value:map}}'),
  76. tooltipValueLookups: { map: { '-1': 'Loss', '0': 'Draw', '1': 'Win' } }
  77. },
  78. // Defaults for discrete charts
  79. discrete: {
  80. lineHeight: 'auto',
  81. thresholdColor: undefined,
  82. thresholdValue: 0,
  83. chartRangeMax: undefined,
  84. chartRangeMin: undefined,
  85. chartRangeClip: false,
  86. tooltipFormat: new SPFormat('{{prefix}}{{value}}{{suffix}}')
  87. },
  88. // Defaults for bullet charts
  89. bullet: {
  90. targetColor: '#f33',
  91. targetWidth: 3, // width of the target bar in pixels
  92. performanceColor: '#33f',
  93. rangeColors: ['#d3dafe', '#a8b6ff', '#7f94ff'],
  94. base: undefined, // set this to a number to change the base start number
  95. tooltipFormat: new SPFormat('{{fieldkey:fields}} - {{value}}'),
  96. tooltipValueLookups: { fields: {r: 'Range', p: 'Performance', t: 'Target'} }
  97. },
  98. // Defaults for pie charts
  99. pie: {
  100. offset: 0,
  101. sliceColors: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00',
  102. '#dd4477', '#0099c6', '#990099'],
  103. borderWidth: 0,
  104. borderColor: '#000',
  105. tooltipFormat: new SPFormat('<span style="color: {{color}}">&#9679;</span> {{value}} ({{percent.1}}%)')
  106. },
  107. // Defaults for box plots
  108. box: {
  109. raw: false,
  110. boxLineColor: '#000',
  111. boxFillColor: '#cdf',
  112. whiskerColor: '#000',
  113. outlierLineColor: '#333',
  114. outlierFillColor: '#fff',
  115. medianColor: '#f00',
  116. showOutliers: true,
  117. outlierIQR: 1.5,
  118. spotRadius: 1.5,
  119. target: undefined,
  120. targetColor: '#4a2',
  121. chartRangeMax: undefined,
  122. chartRangeMin: undefined,
  123. tooltipFormat: new SPFormat('{{field:fields}}: {{value}}'),
  124. tooltipFormatFieldlistKey: 'field',
  125. tooltipValueLookups: { fields: { lq: 'Lower Quartile', med: 'Median',
  126. uq: 'Upper Quartile', lo: 'Left Outlier', ro: 'Right Outlier',
  127. lw: 'Left Whisker', rw: 'Right Whisker'} }
  128. }
  129. };
  130. };
  131. // You can have tooltips use a css class other than jqstooltip by specifying tooltipClassname
  132. defaultStyles = '.jqstooltip { ' +
  133. 'position: absolute;' +
  134. 'left: 0px;' +
  135. 'top: 0px;' +
  136. 'visibility: hidden;' +
  137. 'background: rgb(0, 0, 0) transparent;' +
  138. 'background-color: rgba(0,0,0,0.6);' +
  139. 'filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);' +
  140. '-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";' +
  141. 'color: white;' +
  142. 'font: 10px arial, san serif;' +
  143. 'text-align: left;' +
  144. 'white-space: nowrap;' +
  145. 'padding: 5px;' +
  146. 'border: 1px solid white;' +
  147. 'box-sizing: content-box;' +
  148. 'z-index: 10000;' +
  149. '}' +
  150. '.jqsfield { ' +
  151. 'color: white;' +
  152. 'font: 10px arial, san serif;' +
  153. 'text-align: left;' +
  154. '}';