Вход Регистрация
Файл: src/public/plugins/metrics-graphics/common/data_graphic.js
Строк: 227
<?php
MG
.globals = {};
MG.deprecations = {
  
rollover_callback: { replacement'mouseover'version'2.0' },
  
rollout_callback: { replacement'mouseout'version'2.0' },
  
x_rollover_format: { replacement'x_mouseover'version'2.10' },
  
y_rollover_format: { replacement'y_mouseover'version'2.10' },
  
show_years: { replacement'show_secondary_x_label'version'2.1' },
  
xax_start_at_min: { replacement'axes_not_compact'version'2.7' }
};
MG.globals.link false;
MG.globals.version "1.1";

MG.charts = {};

MG.data_graphic = function(args) {
  
'use strict';
  var 
defaults = {
    
missing_is_zerofalse,             // if true, missing values will be treated as zeros
    
missing_is_hiddenfalse,           // if true, missing values will appear as broken segments
    
missing_is_hidden_accessornull,   // the accessor that determines the boolean value for missing data points
    
legend'' ,                        // an array identifying the labels for a chart's lines
    
legend_target'',                  // if set, the specified element is populated with a legend
    
error'',                          // if set, a graph will show an error icon and log the error to the console
    
animate_on_loadfalse,             // animate lines on load
    
top65,                            // the size of the top margin
    
title_y_position10,               // how many pixels from the top edge (0) should we show the title at
    
bottom45,                         // the size of the bottom margin
    
right10,                          // size of the right margin
    
left50,                           // size of the left margin
    
buffer8,                          // the buffer between the actual chart area and the margins
    
width350,                         // the width of the entire graphic
    
height220,                        // the height of the entire graphic
    
full_widthfalse,                  // sets the graphic width to be the width of the parent element and resizes dynamically
    
full_heightfalse,                 // sets the graphic width to be the width of the parent element and resizes dynamically
    
small_height_threshold120,        // the height threshold for when smaller text appears
    
small_width_threshold160,         // the width  threshold for when smaller text appears
    
xax_count6,                       // number of x axis ticks
    
xax_tick_length5,                 // x axis tick length
    
axes_not_compacttrue,
    
yax_count5,                       // number of y axis ticks
    
yax_tick_length5,                 // y axis tick length
    
x_extended_ticksfalse,            // extends x axis ticks across chart - useful for tall charts
    
y_extended_ticksfalse,            // extends y axis ticks across chart - useful for long charts
    
y_scale_type'linear',
    
max_xnull,
    
max_ynull,
    
min_xnull,
    
min_ynull,                        // if set, y axis starts at an arbitrary value
    
min_y_from_datafalse,             // if set, y axis will start at minimum value rather than at 0
    
point_size2.5,                    // the size of the dot that appears on a line on mouse-over
    
x_accessor'date',
    
xax_units'',
    
x_label'',
    
x_sorttrue,
    
x_axistrue,
    
y_axistrue,
    
y_accessor'value',
    
y_label'',
    
yax_units'',
    
x_rugfalse,
    
y_rugfalse,
    
mouseover_align'right',           // implemented in point.js
    
x_mouseovernull,
    
y_mouseovernull,
    
transition_on_updatetrue,
    
mouseovernull,
    
clicknull,
    
show_rollover_texttrue,
    
show_confidence_bandnull,         // given [l, u] shows a confidence at each point from l to u
    
xax_formatnull,                   // xax_format is a function that formats the labels for the x axis.
    
areatrue,
    
chart_type'line',
    
data: [],
    
decimals2,                        // the number of decimals in any rollover
    
format'count',                    // format = {count, percentage}
    
inflator10/9,                     // for setting y axis max
    
linkedfalse,                      // links together all other graphs with linked:true, so rollovers in one trigger rollovers in the others
    
linked_format'%Y-%m-%d',          // What granularity to link on for graphs. Default is at day
    
list: false,
    
baselinesnull,                    // sets the baseline lines
    
markersnull,                      // sets the marker lines
    
scalefns: {},
    
scales: {},
    
utc_timefalse,
    
european_clockfalse,
    
show_year_markersfalse,
    
show_secondary_x_labeltrue,
    
target'#viz',
    
interpolate'cardinal',            // interpolation method to use when rendering lines
    
interpolate_tension0.7,           // its range is from 0 to 1; increase if your data is irregular and you notice artifacts
    
custom_line_color_map: [],          // allows arbitrary mapping of lines to colors, e.g. [2,3] will map line 1 to color 2 and line 2 to color 3
    
colorsnull,                       // UNIMPLEMENTED - allows direct color mapping to line colors. Will eventually require
    
max_data_sizenull,                // explicitly specify the the max number of line series, for use with custom_line_color_map
    
aggregate_rolloverfalse,          // links the lines in a multi-line chart
    
show_tooltipstrue                 // if enabled, a chart's description will appear in a tooltip (requires jquery)
  
};

  
MG.call_hook('global.defaults'defaults);

  if (!
args) { args = {}; }

  var 
selected_chart MG.charts[args.chart_type || defaults.chart_type];
  
merge_with_defaults(argsselected_chart.defaultsdefaults);

  if (
args.list) {
    
args.x_accessor 0;
    
args.y_accessor 1;
  }

  
// check for deprecated parameters
  
for (var key in MG.deprecations) {
    if (
args.hasOwnProperty(key)) {
      var 
deprecation MG.deprecations[key],
        
message 'Use of `args.' key '` has been deprecated',
        
replacement deprecation.replacement,
        
version;

      
// transparently alias the deprecated
      
if (replacement) {
        if (
args[replacement]) {
          
message += '. The replacement - `args.' replacement '` - has already been defined. This definition will be discarded.';
        } else {
          
args[replacement] = args[key];
        }
      }

      if (
deprecation.warned) {
        continue;
      }

      
deprecation.warned true;

      if (
replacement) {
        
message += ' in favor of `args.' replacement '`';
      }

      
warn_deprecation(messagedeprecation.version);
    }
  }

  
MG.call_hook('global.before_init'args);

  new 
selected_chart.descriptor(args);

  return 
args.data;
};
?>
Онлайн: 1
Реклама