123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- (function($) {
-
-
- $.jqplot.AxisTickRenderer = function(options) {
-
- $.jqplot.ElemContainer.call(this);
-
-
- this.mark = 'outside';
-
- this.axis;
-
-
- this.showMark = true;
-
-
- this.showGridline = true;
-
-
- this.isMinorTick = false;
-
-
-
- this.size = 4;
-
-
-
- this.markSize = 6;
-
-
-
-
- this.show = true;
-
-
- this.showLabel = true;
- this.label = null;
- this.value = null;
- this._styles = {};
-
-
- this.formatter = $.jqplot.DefaultTickFormatter;
-
-
-
- this.prefix = '';
-
-
-
- this.suffix = '';
-
-
- this.formatString = '';
-
-
- this.fontFamily;
-
-
- this.fontSize;
-
-
- this.textColor;
-
-
- this.escapeHTML = false;
- this._elem;
- this._breakTick = false;
-
- $.extend(true, this, options);
- };
-
- $.jqplot.AxisTickRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- };
-
- $.jqplot.AxisTickRenderer.prototype = new $.jqplot.ElemContainer();
- $.jqplot.AxisTickRenderer.prototype.constructor = $.jqplot.AxisTickRenderer;
-
- $.jqplot.AxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
- this.value = value;
- this.axis = axisName;
- if (isMinor) {
- this.isMinorTick = true;
- }
- return this;
- };
-
- $.jqplot.AxisTickRenderer.prototype.draw = function() {
- if (this.label === null) {
- this.label = this.prefix + this.formatter(this.formatString, this.value) + this.suffix;
- }
- var style = {position: 'absolute'};
- if (Number(this.label)) {
- style['whitSpace'] = 'nowrap';
- }
-
-
- if (this._elem) {
- this._elem.emptyForce();
- this._elem = null;
- }
- this._elem = $(document.createElement('div'));
- this._elem.addClass("jqplot-"+this.axis+"-tick");
-
- if (!this.escapeHTML) {
- this._elem.html(this.label);
- }
- else {
- this._elem.text(this.label);
- }
-
- this._elem.css(style);
- for (var s in this._styles) {
- this._elem.css(s, this._styles[s]);
- }
- if (this.fontFamily) {
- this._elem.css('font-family', this.fontFamily);
- }
- if (this.fontSize) {
- this._elem.css('font-size', this.fontSize);
- }
- if (this.textColor) {
- this._elem.css('color', this.textColor);
- }
- if (this._breakTick) {
- this._elem.addClass('jqplot-breakTick');
- }
-
- return this._elem;
- };
-
- $.jqplot.DefaultTickFormatter = function (format, val) {
- if (typeof val == 'number') {
- if (!format) {
- format = $.jqplot.config.defaultTickFormatString;
- }
- return $.jqplot.sprintf(format, val);
- }
- else {
- return String(val);
- }
- };
-
- $.jqplot.PercentTickFormatter = function (format, val) {
- if (typeof val == 'number') {
- val = 100 * val;
- if (!format) {
- format = $.jqplot.config.defaultTickFormatString;
- }
- return $.jqplot.sprintf(format, val);
- }
- else {
- return String(val);
- }
- };
-
- $.jqplot.AxisTickRenderer.prototype.pack = function() {
- };
- })(jQuery);
|