Skip to content

Instantly share code, notes, and snippets.

@benaskins
Created December 29, 2008 06:57
Show Gist options
  • Select an option

  • Save benaskins/41203 to your computer and use it in GitHub Desktop.

Select an option

Save benaskins/41203 to your computer and use it in GitHub Desktop.
// X and Y axis labels and captions default to global style if not provided
// - X Axis Labels
if (!this.settings.xAxisLabelColor) {
this.settings.xAxisLabelColor = this.settings.labelColor;
}
if (!this.settings.xAxisLabelFont) {
this.settings.xAxisLabelFont = this.settings.labelFont;
}
if (!this.settings.xAxisLabelFontSize) {
this.settings.xAxisLabelFontSize = this.settings.labelFontSize;
}
// - Y Axis Labels
if (!this.settings.yAxisLabelColor) {
this.settings.yAxisLabelColor = this.settings.labelColor;
}
if (!this.settings.yAxisLabelFont) {
this.settings.yAxisLabelFont = this.settings.labelFont;
}
if (!this.settings.yAxisLabelFontSize) {
this.settings.yAxisLabelFontSize = this.settings.labelFontSize;
}
// - Y Axis Caption
if (!this.settings.yAxisCaptionColor) {
this.settings.yAxisCaptionColor = this.settings.labelColor;
}
if (!this.settings.yAxisCaptionFont) {
this.settings.yAxisCaptionFont = this.settings.labelFont;
}
if (!this.settings.yAxisCaptionFontSize) {
this.settings.yAxisCaptionFontSize = this.settings.labelFontSize;
}
// - Hover Labels - Labels from the X Axis that appear when hovering over points in the graph
if (!this.settings.hoverLabelColor) {
this.settings.hoverLabelColor = this.settings.labelColor;
}
if (!this.settings.hoverLabelFont) {
this.settings.hoverLabelFont = this.settings.labelFont;
}
if (!this.settings.hoverLabelFontSize) {
this.settings.hoverLabelFontSize = this.settings.labelFontSize;
}
// - Hover Values - Values from the Y Axis that appear when hovering over points in the graph
if (!this.settings.hoverValueColor) {
this.settings.hoverValueColor = this.settings.labelColor;
}
if (!this.settings.hoverValueFont) {
this.settings.hoverValueFont = this.settings.labelFont;
}
if (!this.settings.hoverValueFontSize) {
this.settings.hoverValueFontSize = this.settings.labelFontSize;
}
// Label Styles
// - General
this.labelStyle = {
font: this.settings.labelFontSize + '"' + this.settings.labelFont + '"',
fill: this.settings.labelColor
};
// - X Axis Labels
this.xAxisLabelStyle = {
font: this.settings.xAxisLabelFontSize + '"' + this.settings.xAxisLabelFont + '"',
fill: this.settings.xAxisLabelColor
};
// - Y Axis Labels
this.yAxisLabelStyle = {
font: this.settings.yAxisLabelFontSize + '"' + this.settings.yAxisLabelFont + '"',
fill: this.settings.yAxisLabelColor
};
// - Y Axis Caption
this.yAxisCaptionStyle = {
font: this.settings.yAxisCaptionFontSize + '"' + this.settings.yAxisCaptionFont + '"',
fill: this.settings.yAxisCaptionColor
};
// - Hover Labels
this.hoverLabelStyle = {
font: this.settings.hoverLabelFontSize + '"' + this.settings.hoverLabelFont + '"',
fill: this.settings.hoverLabelColor
};
// - Hover Values
this.hoverValueStyle = {
font: this.settings.hoverValueFontSize + '"' + this.settings.hoverValueFont + '"',
fill: this.settings.hoverValueColor
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment