Javascript teechart - 设置最小值或最大值不起作用?
Javascript teechart - set min or max not working?
我们遇到以下问题 - 无论我们尝试什么,我们都无法在 javascript 的图表上设置最小值或最大值。
Chart1 = new Tee.Chart("canvas");
var a = new Tee.Area();
Chart1.addSeries(a);
a.data.values = values
a.data.x = times;
a.format.fill = "rgba(0,175,240,0.0)";
var aa = new Tee.Line();
Chart1.addSeries(aa);
aa.data.values = values
aa.data.x = times;
Chart1.getSeries(0).vertAxis = "right";
Chart1.getSeries(1).vertAxis = "right";
Chart1.axes.bottom.labels.dateFormat = "UTC:HH:MM:ss";
Chart1.axes.right.labels.decimals = 5;
Chart1.axes.right.grid.format.stroke.fill = "#191919";
Chart1.axes.right.labels.format.font.fill = "#ccc";
Chart1.axes.bottom.grid.format.stroke.fill = "#191919";
Chart1.axes.bottom.labels.format.font.fill = "#ccc";
Chart1.getSeries(0).format.gradient.visible = true;
Chart1.getSeries(0).format.gradient.colors = ["rgba(0,175,240,0.2)", "rgba(255,175,240,1)"];
Chart1.getSeries(0).format.gradient.stops = [0, 1];
Chart1.getSeries(0).format.stroke.fill = "rgba(0,175,240,0)";
Chart1.getSeries(1).format.stroke.fill = "rgba(0,175,240,1)";
Chart1.getSeries(0).format.stroke.size = 0;
Chart1.getSeries(1).format.stroke.size = 2;
Chart1.title.visible = false;
Chart1.walls.back.visible = false;
Chart1.panel.transparent = true;
Chart1.legend.visible = false;
var maxValue = data[data.length - 1][0];
var minValue = data[0][0];
maxValue = maxValue + 1000 * 60 * 10;
maxValue = new Date(maxValue);
//Chart1.axes.bottom.setMinMax(minValue, maxValue);
Chart1.axes.bottom.maximum = maxValue;
Chart1.axes.bottom.minimum = minValue;
Chart1.draw();
底部的轴包含日期,我们试图将 10 分钟添加到最后一个日期值并将其设置为最大值,并从第一个日期值中删除 10 分钟并将其设置为最小值。无论我们如何努力,我们都无法实现。
这对我来说似乎很好用:
var tenMinutes = 1000 * 60 * 10;
var minValue = series1.minXValue();
var maxValue = series1.maxXValue();
minValue = minValue - tenMinutes;
maxValue = maxValue + tenMinutes;
Chart1.axes.bottom.setMinMax(minValue, maxValue);
我们遇到以下问题 - 无论我们尝试什么,我们都无法在 javascript 的图表上设置最小值或最大值。
Chart1 = new Tee.Chart("canvas");
var a = new Tee.Area();
Chart1.addSeries(a);
a.data.values = values
a.data.x = times;
a.format.fill = "rgba(0,175,240,0.0)";
var aa = new Tee.Line();
Chart1.addSeries(aa);
aa.data.values = values
aa.data.x = times;
Chart1.getSeries(0).vertAxis = "right";
Chart1.getSeries(1).vertAxis = "right";
Chart1.axes.bottom.labels.dateFormat = "UTC:HH:MM:ss";
Chart1.axes.right.labels.decimals = 5;
Chart1.axes.right.grid.format.stroke.fill = "#191919";
Chart1.axes.right.labels.format.font.fill = "#ccc";
Chart1.axes.bottom.grid.format.stroke.fill = "#191919";
Chart1.axes.bottom.labels.format.font.fill = "#ccc";
Chart1.getSeries(0).format.gradient.visible = true;
Chart1.getSeries(0).format.gradient.colors = ["rgba(0,175,240,0.2)", "rgba(255,175,240,1)"];
Chart1.getSeries(0).format.gradient.stops = [0, 1];
Chart1.getSeries(0).format.stroke.fill = "rgba(0,175,240,0)";
Chart1.getSeries(1).format.stroke.fill = "rgba(0,175,240,1)";
Chart1.getSeries(0).format.stroke.size = 0;
Chart1.getSeries(1).format.stroke.size = 2;
Chart1.title.visible = false;
Chart1.walls.back.visible = false;
Chart1.panel.transparent = true;
Chart1.legend.visible = false;
var maxValue = data[data.length - 1][0];
var minValue = data[0][0];
maxValue = maxValue + 1000 * 60 * 10;
maxValue = new Date(maxValue);
//Chart1.axes.bottom.setMinMax(minValue, maxValue);
Chart1.axes.bottom.maximum = maxValue;
Chart1.axes.bottom.minimum = minValue;
Chart1.draw();
底部的轴包含日期,我们试图将 10 分钟添加到最后一个日期值并将其设置为最大值,并从第一个日期值中删除 10 分钟并将其设置为最小值。无论我们如何努力,我们都无法实现。
这对我来说似乎很好用:
var tenMinutes = 1000 * 60 * 10;
var minValue = series1.minXValue();
var maxValue = series1.maxXValue();
minValue = minValue - tenMinutes;
maxValue = maxValue + tenMinutes;
Chart1.axes.bottom.setMinMax(minValue, maxValue);