From eca6f500f4435934bd6afd4404c2bfa783606cbf Mon Sep 17 00:00:00 2001 From: Justin Lan Date: Thu, 3 Jul 2014 11:16:40 -0700 Subject: [PATCH] Restore default Line Plot stylings; project() default styles By project()-ing the default styles instead of having them in the CSS, they can be overridden by the user using project(). Downside: harder to discover default values. --- plottable.css | 12 +++++------- plottable.js | 11 +++++++---- src/components/plots/areaPlot.ts | 1 + src/components/plots/linePlot.ts | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/plottable.css b/plottable.css index e6acdf7ea7..315279a87e 100644 --- a/plottable.css +++ b/plottable.css @@ -70,17 +70,15 @@ svg.plottable { font-size: 14pt; } -.plottable .area-renderer path.area { - stroke: none; - fill-opacity: 0.5; -} - -.plottable .area-renderer path.line { +.plottable .line-renderer path.line { fill: none; - stroke-width: 2px; vector-effect: non-scaling-stroke; } +.plottable .area-renderer path.area { + stroke: none; +} + .plottable .legend .toggled-off circle { fill: #d3d3d3; } diff --git a/plottable.js b/plottable.js index 0e074ba6f2..48bee8590a 100644 --- a/plottable.js +++ b/plottable.js @@ -6319,10 +6319,10 @@ var Plottable; this.classed("line-renderer", true); this.project("stroke", function () { return "steelblue"; - }); - this.project("fill", function () { - return "none"; - }); + }); // default + this.project("stroke-width", function () { + return "2px"; + }); // default } Line.prototype._setup = function () { _super.prototype._setup.call(this); @@ -6386,6 +6386,9 @@ var Plottable; this.project("fill", function () { return "steelblue"; }); // default + this.project("fill-opacity", function () { + return 0.5; + }); // default this.project("stroke", function () { return "none"; }); // default diff --git a/src/components/plots/areaPlot.ts b/src/components/plots/areaPlot.ts index 109405e1fb..9164a414c6 100644 --- a/src/components/plots/areaPlot.ts +++ b/src/components/plots/areaPlot.ts @@ -20,6 +20,7 @@ export module Plot { this.classed("area-renderer", true); this.project("y0", 0, yScale); // default this.project("fill", () => "steelblue"); // default + this.project("fill-opacity", () => 0.5); // default this.project("stroke", () => "none"); // default this._animators["area-reset"] = new Animator.Null(); this._animators["area"] = new Animator.Default() diff --git a/src/components/plots/linePlot.ts b/src/components/plots/linePlot.ts index 6854f392ad..73062d63f8 100644 --- a/src/components/plots/linePlot.ts +++ b/src/components/plots/linePlot.ts @@ -23,8 +23,8 @@ export module Plot { constructor(dataset: any, xScale: Abstract.Scale, yScale: Abstract.Scale) { super(dataset, xScale, yScale); this.classed("line-renderer", true); - this.project("stroke", () => "steelblue"); - this.project("fill", () => "none"); + this.project("stroke", () => "steelblue"); // default + this.project("stroke-width", () => "2px"); // default } public _setup() {