flot 曲线从第一点开始
flot curved line start with first point
我正在使用 flotjs 插件创建图表。
在我的示例中,第一条曲线以 (0,0) 开头,但我需要我的线以 (20,20) 开头,我的意思是从第一个点开始,而不是 (0,0)...看我的第二个示例,这些线是从第一个点开始,而不是从 (0,0) position.i 开始,在曲线图上也需要相同的模式。我该怎么做?
//data
var d1 = [[null,],[20, 20], [25, 50], [27.5, 35], [30, 20], [35, 20]];
//flot options
var options = {
series: {
curvedLines: {active: true}
} };
//plotting
$.plot($("#flotContainer"),[
{
data: d1, color: '#2b8cbe',
lines: {show: true, lineWidth: 3},
//choose tension from [0,1] to see overshooting effects (0.5 is default)
curvedLines: {apply: true, tension: 1}
}, {
data: d1, color: '#f03b20',
points: {show: true}
}
], options);
$.plot($("#flotContainer2"),[
{
data: d1, color: '#2b8cbe',
lines: {show: true, lineWidth: 3},
//monotonicFit enforces monotonicity
curvedLines: {apply: true, monotonicFit: true}
}, {
data: d1, color: '#f03b20',
points: {show: true}
}
], options);
.chart-style {
width: 400px;
height: 240px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
<script src="https://rawgit.com/MichaelZinsmaier/CurvedLines/master/curvedLines.js"></script>
<h4>CurvedLines: with standard settings (shows effects of tension parameter)</h4>
<div id="flotContainer" class="chart-style"></div>
<h4>CurvedLines: with monotonicFit (no overshooting/wiggles) </h4>
<div id="flotContainer2" class="chart-style"></div>
但它在折线图上工作正常
var data = [
{
label: 'foo',
color: 'red',
data: [[0,null],[1, 300], [2, 300], [3, 300], [4, 300], [5, 300]]},
{
label: 'bar',
color: 'blue',
data: [[1, 800], [2, 600], [3, 400], [4, 200], [5, 0]]},
{ label: 'baz',
olor: 'yellow',
data: [[1, 100], [2, 200], [3, 300], [4, 400], [5, 500]]},
{
label: 'dart',
color: 'green',
data: [[1, 500], [2, 350], [3, 400], [4, 700], [5, 50]]}
];
var flot = $.plot($("#placeholder"), data, {
series: {
lines: {
show: true
},
points:{
show:true
}
},
legend: {
noColumns: 4,
container: $("#chartLegend")
}
});
#chartLegend .legendLabel { padding-right:10px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://people.iola.dk/olau/flot/jquery.flot.js"></script>
<script src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
<div id="placeholder" style="width:600px;height:300px;"></div>
<div id="chartLegend"></div>
curvedLines 插件使用您的第一个数据点 [null,]
并将其转换为 [0,0]
。删除该数据点,曲线从 [20,20]
.
开始
//data
var d1 = [
[20, 20],
[25, 50],
[27.5, 35],
[30, 20],
[35, 20]
];
//flot options
var options = {
series: {
curvedLines: {
active: true
}
}
};
//plotting
$.plot($("#flotContainer"), [{
data: d1,
color: '#2b8cbe',
lines: {
show: true,
lineWidth: 3
},
//choose tension from [0,1] to see overshooting effects (0.5 is default)
curvedLines: {
apply: true,
tension: 1
}
}, {
data: d1,
color: '#f03b20',
points: {
show: true
}
}], options);
$.plot($("#flotContainer2"), [{
data: d1,
color: '#2b8cbe',
lines: {
show: true,
lineWidth: 3
},
//monotonicFit enforces monotonicity
curvedLines: {
apply: true,
monotonicFit: true
}
}, {
data: d1,
color: '#f03b20',
points: {
show: true
}
}], options);
.chart-style {
width: 400px;
height: 240px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
<script src="https://rawgit.com/MichaelZinsmaier/CurvedLines/master/curvedLines.js"></script>
<h4>CurvedLines: with standard settings (shows effects of tension parameter)</h4>
<div id="flotContainer" class="chart-style"></div>
<h4>CurvedLines: with monotonicFit (no overshooting/wiggles) </h4>
<div id="flotContainer2" class="chart-style"></div>
我正在使用 flotjs 插件创建图表。 在我的示例中,第一条曲线以 (0,0) 开头,但我需要我的线以 (20,20) 开头,我的意思是从第一个点开始,而不是 (0,0)...看我的第二个示例,这些线是从第一个点开始,而不是从 (0,0) position.i 开始,在曲线图上也需要相同的模式。我该怎么做?
//data
var d1 = [[null,],[20, 20], [25, 50], [27.5, 35], [30, 20], [35, 20]];
//flot options
var options = {
series: {
curvedLines: {active: true}
} };
//plotting
$.plot($("#flotContainer"),[
{
data: d1, color: '#2b8cbe',
lines: {show: true, lineWidth: 3},
//choose tension from [0,1] to see overshooting effects (0.5 is default)
curvedLines: {apply: true, tension: 1}
}, {
data: d1, color: '#f03b20',
points: {show: true}
}
], options);
$.plot($("#flotContainer2"),[
{
data: d1, color: '#2b8cbe',
lines: {show: true, lineWidth: 3},
//monotonicFit enforces monotonicity
curvedLines: {apply: true, monotonicFit: true}
}, {
data: d1, color: '#f03b20',
points: {show: true}
}
], options);
.chart-style {
width: 400px;
height: 240px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
<script src="https://rawgit.com/MichaelZinsmaier/CurvedLines/master/curvedLines.js"></script>
<h4>CurvedLines: with standard settings (shows effects of tension parameter)</h4>
<div id="flotContainer" class="chart-style"></div>
<h4>CurvedLines: with monotonicFit (no overshooting/wiggles) </h4>
<div id="flotContainer2" class="chart-style"></div>
但它在折线图上工作正常
var data = [
{
label: 'foo',
color: 'red',
data: [[0,null],[1, 300], [2, 300], [3, 300], [4, 300], [5, 300]]},
{
label: 'bar',
color: 'blue',
data: [[1, 800], [2, 600], [3, 400], [4, 200], [5, 0]]},
{ label: 'baz',
olor: 'yellow',
data: [[1, 100], [2, 200], [3, 300], [4, 400], [5, 500]]},
{
label: 'dart',
color: 'green',
data: [[1, 500], [2, 350], [3, 400], [4, 700], [5, 50]]}
];
var flot = $.plot($("#placeholder"), data, {
series: {
lines: {
show: true
},
points:{
show:true
}
},
legend: {
noColumns: 4,
container: $("#chartLegend")
}
});
#chartLegend .legendLabel { padding-right:10px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://people.iola.dk/olau/flot/jquery.flot.js"></script>
<script src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
<div id="placeholder" style="width:600px;height:300px;"></div>
<div id="chartLegend"></div>
curvedLines 插件使用您的第一个数据点 [null,]
并将其转换为 [0,0]
。删除该数据点,曲线从 [20,20]
.
//data
var d1 = [
[20, 20],
[25, 50],
[27.5, 35],
[30, 20],
[35, 20]
];
//flot options
var options = {
series: {
curvedLines: {
active: true
}
}
};
//plotting
$.plot($("#flotContainer"), [{
data: d1,
color: '#2b8cbe',
lines: {
show: true,
lineWidth: 3
},
//choose tension from [0,1] to see overshooting effects (0.5 is default)
curvedLines: {
apply: true,
tension: 1
}
}, {
data: d1,
color: '#f03b20',
points: {
show: true
}
}], options);
$.plot($("#flotContainer2"), [{
data: d1,
color: '#2b8cbe',
lines: {
show: true,
lineWidth: 3
},
//monotonicFit enforces monotonicity
curvedLines: {
apply: true,
monotonicFit: true
}
}, {
data: d1,
color: '#f03b20',
points: {
show: true
}
}], options);
.chart-style {
width: 400px;
height: 240px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/flot/flot/v0.8.3/jquery.flot.js"></script>
<script src="https://rawgit.com/MichaelZinsmaier/CurvedLines/master/curvedLines.js"></script>
<h4>CurvedLines: with standard settings (shows effects of tension parameter)</h4>
<div id="flotContainer" class="chart-style"></div>
<h4>CurvedLines: with monotonicFit (no overshooting/wiggles) </h4>
<div id="flotContainer2" class="chart-style"></div>