Fixed horizontal and vertical line drawing.
This commit is contained in:
parent
ec40240bcc
commit
b1c83a53aa
@ -145,6 +145,7 @@
|
||||
<script type="text/javascript" src="jqplot/plugins/jqplot.ohlcRenderer.min.js"></script>
|
||||
<script type="text/javascript" src="jqplot/plugins/jqplot.pieRenderer.min.js"></script>
|
||||
<script type="text/javascript" src="jqplot/plugins/jqplot.highlighter.min.js"></script>
|
||||
<script type="text/javascript" src="jqplot/plugins/jqplot.canvasOverlay.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/entries.js"></script>
|
||||
</body>
|
||||
|
@ -379,18 +379,9 @@ drawChart = function(entries, element) {
|
||||
$(element).html("");
|
||||
|
||||
if(entries && entries.length > 0) {
|
||||
var day = 24 * 60 * 60 * 1000;
|
||||
|
||||
var lastDate = new Date(Date.parse(entries[entries.length -1][0]).valueOf() + 1 * day);
|
||||
var firstDate = new Date(Date.parse(entries[0][0]).valueOf() - 1 * day);
|
||||
var chartValues = [[], []];
|
||||
|
||||
// For the '0' line.
|
||||
chartValues[0].push(
|
||||
[new Date(firstDate.valueOf()).toString(), 0],
|
||||
[new Date(lastDate.valueOf()).toString(), 0]);
|
||||
|
||||
chartValues[1] = entries;
|
||||
chartValues[0] = entries;
|
||||
|
||||
// plot chart
|
||||
window.chart = $.jqplot(element.id, chartValues, {
|
||||
@ -411,16 +402,27 @@ drawChart = function(entries, element) {
|
||||
},
|
||||
|
||||
series: [{
|
||||
linePattern: "dashed",
|
||||
lineWidth: 1,
|
||||
color: "red",
|
||||
showMarker: false
|
||||
},{
|
||||
renderer:$.jqplot.OHLCRenderer,
|
||||
color: "blue",
|
||||
lineWidth: 3,
|
||||
rendererOptions:{
|
||||
}}],
|
||||
rendererOptions:{}
|
||||
}],
|
||||
canvasOverlay: {
|
||||
show: true,
|
||||
objects: [{
|
||||
dashedHorizontalLine: {
|
||||
name: "zero",
|
||||
y: 0,
|
||||
lineWidth: 1,
|
||||
color: "red"
|
||||
}},
|
||||
{ dashedVerticalLine: {
|
||||
name: "today",
|
||||
x: new Date(),
|
||||
lineWidth: 1,
|
||||
color: "gray"
|
||||
}}]
|
||||
}
|
||||
});
|
||||
} else {
|
||||
window.chart = null;
|
||||
|
Loading…
Reference in New Issue
Block a user