Commit df7faa75 authored by olau@iola.dk's avatar olau@iola.dk

Fixed problems with not showing lines

git-svn-id: https://flot.googlecode.com/svn/trunk@100 1e0a6537-2640-0410-bfb7-f154510ff394
parent 8704eee8
......@@ -6,7 +6,10 @@ analysis by Joshua Varner). Fix auto-adjustment code when setting min
to 0 for an axis where the dataset is completely flat on that axis
(report by chovy). Fixed a bug with passing in data from getData to
setData when the secondary axes are used (issue 65, reported by
nperelman).
nperelman). Fixed so that it is possible to turn lines off when no
other chart type is shown (based on problem reported by Glenn
Vanderburg), and fixed so that setting lineWidth to 0 also hides the
shadow (based on problem reported by Sergio Nunes).
Flot 0.5
......
......@@ -60,7 +60,8 @@
fillColor: "#ffffff"
},
lines: {
show: false,
// we don't put in show: false so we can see
// whether the user actively disabled lines
lineWidth: 2, // in pixels
fill: false,
fillColor: null
......@@ -232,6 +233,10 @@
s.lines = $.extend(true, {}, options.lines, s.lines);
s.points = $.extend(true, {}, options.points, s.points);
s.bars = $.extend(true, {}, options.bars, s.bars);
// turn on lines automatically in case nothing is set
if (s.lines.show == null && !s.bars.show && !s.points.show)
s.lines.show = true;
if (s.shadowSize == null)
s.shadowSize = options.shadowSize;
......@@ -1031,7 +1036,7 @@
}
function drawSeries(series) {
if (series.lines.show || (!series.bars.show && !series.points.show))
if (series.lines.show)
drawSeriesLines(series);
if (series.bars.show)
drawSeriesBars(series);
......@@ -1266,18 +1271,17 @@
ctx.translate(plotOffset.left, plotOffset.top);
ctx.lineJoin = "round";
var lw = series.lines.lineWidth;
var sw = series.shadowSize;
var lw = series.lines.lineWidth,
sw = series.shadowSize;
// FIXME: consider another form of shadow when filling is turned on
if (sw > 0) {
if (lw > 0 && sw > 0) {
// draw shadow in two steps
ctx.lineWidth = sw / 2;
var w = sw / 2;
ctx.lineWidth = w;
ctx.strokeStyle = "rgba(0,0,0,0.1)";
plotLine(series.data, lw/2 + sw/2 + ctx.lineWidth/2, series.xaxis, series.yaxis);
ctx.lineWidth = sw / 2;
plotLine(series.data, lw/2 + w + w/2, series.xaxis, series.yaxis);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
plotLine(series.data, lw/2 + ctx.lineWidth/2, series.xaxis, series.yaxis);
plotLine(series.data, lw/2 + w/2, series.xaxis, series.yaxis);
}
ctx.lineWidth = lw;
......@@ -1285,6 +1289,8 @@
setFillStyle(series.lines, series.color);
if (series.lines.fill)
plotLineArea(series.data, series.xaxis, series.yaxis);
if (lw > 0)
plotLine(series.data, 0, series.xaxis, series.yaxis);
ctx.restore();
}
......@@ -1324,18 +1330,18 @@
ctx.save();
ctx.translate(plotOffset.left, plotOffset.top);
var lw = series.lines.lineWidth;
var sw = series.shadowSize;
if (sw > 0) {
var lw = series.lines.lineWidth,
sw = series.shadowSize;
if (lw > 0 && sw > 0) {
// draw shadow in two steps
ctx.lineWidth = sw / 2;
var w = sw / 2;
ctx.lineWidth = w;
ctx.strokeStyle = "rgba(0,0,0,0.1)";
plotPointShadows(series.data, sw/2 + ctx.lineWidth/2,
plotPointShadows(series.data, w + w/2,
series.points.radius, series.xaxis, series.yaxis);
ctx.lineWidth = sw / 2;
ctx.strokeStyle = "rgba(0,0,0,0.2)";
plotPointShadows(series.data, ctx.lineWidth/2,
plotPointShadows(series.data, w/2,
series.points.radius, series.xaxis, series.yaxis);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment