	// I am a EJSC chart configured to display footprint data
  	function FootprintGraph(id, units, opts) {
		
	  var pad_scale = function(chart) {
	  	 chart.y_min = 1;
		 // otherwise removing and showing a series continually
		 // increases y_max
		 if (!chart.padded_y_max) {
		 	chart.padded_y_max = chart.y_max * 1.5;
		 }
		 chart.y_max = chart.padded_y_max; 
		};
	  
	  // one more line wrapping routine is born
	  var wrap_text = function(text_string, width) {
	  	var words = text_string.split(' ');
		var result = '';
		var line_count = 0;
		for (var i=0; i< words.length; i++) {
			line_count += words[i].length;
			if (line_count > width) {
				line_count = 0;
				result += '<br/>';
			}
			result += words[i];
			if (i + 1 < words.length)
				result += ' ';
		}
		return result;
	  };
	  var format_hint = function(point, series, chart, hint_element, HoverOrSelect ) {
	  	ht = '<div class="footprint_chart_hint">[series_title]<br/>';
		ht += '[xcaption]: [x]<br/>';
		ht += '[ycaption]: [y]<br/>';
		// add the hint text if available
		if (point.userdata) {
			ht += wrap_text(point.userdata, 25);
		}
		ht+="</div>"
	  	return ht;
		};
		
      this.chart = new EJSC.Chart(
	  	id, setdefault(opts,{
			show_messages: false, 
			show_titlebar: false,
			auto_zoom: 'y',
			x_axis_formatter: new EJSC.DateFormatter({format_string:"DD/MM/YY"}),
			y_axis_formatter: new EJSC.NumberFormatter({forced_decimals: 1, variable_decimals: 2}),
			x_axis_caption: '',
			y_axis_caption: '',
			x_value_hint_caption: 'Date',
			y_value_hint_caption: units,
			today_plane: {x: new Date().getTime(), show_label: true, show_icon: true, label_dimensions: [13,44], label_offset: [15,5], show: true, color:'rgb(239,62,51)', thickness:1},
			onBeforeDraw: pad_scale,
			onShowHint: format_hint

			}));
	}
	
	// I add footprint data as a line series
	FootprintGraph.prototype.addLineSeries = function(url, opts) {
		this.chart.addSeries(new EJSC.LineSeries(new EJSC.XMLDataHandler(url), setdefault(opts,{lineWidth: 4})));
	};
	// I add footprint data as an area series
	FootprintGraph.prototype.addAreaSeries = function(url, opts) {
		this.chart.addSeries(new EJSC.AreaSeries(new EJSC.XMLDataHandler(url), setdefault(opts,{})));
	};

