- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 amcharts 制作多行。我要使用的类型是平滑线(查看演示 here )。我已经看到可以在此 link 上绘制多个折线图和多个值轴.因此,我尝试使用以下方法在平滑线上实现它:
一个。 2行
它们的比例不同,所以我需要两个 Y 轴。
问题是:只有一个Y轴出现。
这是我使用 javascript 编写的代码:
<script type="text/javascript">
var chart;
var graph;
var chartData = [
{"year":"1950", "v1":0.2, "v2":-26},
{"year":"1951", "v1":-0.2, "v2":-45},
{"year":"1952", "v1":1, "v2":-14},
{"year":"1953", "v1":0.2, "v2":6},
{"year":"1954", "v1":-0.5, "v2":18},
{"year":"1955", "v1":0.8, "v2":-8},
{"year":"1956", "v1":-0.4, "v2":-35},
{"year":"1957", "v1":-0.4, "v2":-37},
{"year":"1958", "v1":-0.2, "v2":27},
{"year":"1959", "v1":1.3, "v2":-14},
{"year":"1960", "v1":1, "v2":8},
{"year":"1961", "v1":0, "v2":-6},
{"year":"1962", "v1":0.4, "v2":9},
{"year":"1963", "v1":-0.3, "v2":-38},
{"year":"1964", "v1":0.7, "v2":-3},
{"year":"1965", "v1":0, "v2":-10},
{"year":"1966", "v1":0.7, "v2":-48},
{"year":"1967", "v1":0.2, "v2":22},
{"year":"1968", "v1":1.1, "v2":-22},
{"year":"1969", "v1":-0.2, "v2":-49},
{"year":"1970", "v1":1.5, "v2":-2},
{"year":"1971", "v1":-0.3, "v2":-37},
{"year":"1972", "v1":1, "v2":-44},
{"year":"1973", "v1":-0.4, "v2":18},
{"year":"1974", "v1":1.2, "v2":-17},
{"year":"1975", "v1":-0.3, "v2":-33},
{"year":"1976", "v1":0.6, "v2":-45},
{"year":"1977", "v1":-0.2, "v2":2},
{"year":"1978", "v1":0.5, "v2":18},
{"year":"1979", "v1":-0.3, "v2":-24},
{"year":"1980", "v1":0.5, "v2":14},
{"year":"1981", "v1":-0.5, "v2":-28},
{"year":"1982", "v1":0.7, "v2":-6},
{"year":"1983", "v1":1.1, "v2":-1},
{"year":"1984", "v1":0.9, "v2":-26},
{"year":"1985", "v1":0.8, "v2":0},
{"year":"1986", "v1":1.5, "v2":-27},
{"year":"1987", "v1":1.4, "v2":26},
{"year":"1988", "v1":-0.5, "v2":26},
{"year":"1989", "v1":0.8, "v2":-45},
{"year":"1990", "v1":0.3, "v2":-23},
{"year":"1991", "v1":1.2, "v2":-21},
{"year":"1992", "v1":-0.2, "v2":-31},
{"year":"1993", "v1":0.8, "v2":-12},
{"year":"1994", "v1":0.3, "v2":-35},
{"year":"1995", "v1":1.1, "v2":-1},
{"year":"1996", "v1":0.9, "v2":-14},
{"year":"1997", "v1":-0.1, "v2":11},
{"year":"1998", "v1":1.1, "v2":-29},
{"year":"1999", "v1":-0.2, "v2":11},
{"year":"2000", "v1":-0.4, "v2":-18},
{"year":"2001", "v1":0.6, "v2":-12},
{"year":"2002", "v1":1.5, "v2":-3},
{"year":"2003", "v1":0.6, "v2":-47},
{"year":"2004", "v1":1.5, "v2":-43},
{"year":"2005", "v1":0.1, "v2":-18},
{"year":"2006", "v1":0, "v2":7},
{"year":"2007", "v1":0.5, "v2":-25},
{"year":"2008", "v1":1.5, "v2":-50},
{"year":"2009", "v1":0.4, "v2":28},
{"year":"2010", "v1":0.7, "v2":25},
{"year":"2011", "v1":0.4, "v2":-16},
{"year":"2012", "v1":-0.2, "v2":5},
{"year":"2013", "v1":0.2, "v2":-17},
{"year":"2014", "v1":-0.5, "v2":-22}
];
AmCharts.ready(function () {
// SERIAL CHART
chart = new AmCharts.AmSerialChart();
chart.pathToImages = "../amcharts/images/";
chart.dataProvider = chartData;
chart.marginLeft = 10;
chart.categoryField = "year";
chart.dataDateFormat = "YYYY";
chart.addListener("dataUpdated", zoomChart);
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.parseDates = true;
categoryAxis.minPeriod = "YYYY";
categoryAxis.dashLength = 3;
categoryAxis.minorGridEnabled = true;
categoryAxis.minorGridAlpha = 0.1;
// value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.id = "ax1";
valueAxis.axisAlpha = 0;
valueAxis.inside = true;
valueAxis.dashLength = 3;
valueAxis.position = "right";
chart.addValueAxis(valueAxis);
var valueAxis2 = new AmCharts.ValueAxis();
valueAxis2.id = "ax2";
valueAxis2.axisAlpha = 0;
valueAxis2.inside = true;
valueAxis2.dashLength = 3;
valueAxis2.baseValue = -20;
valueAxis2.position = "left";
chart.addValueAxis(valueAxis2);
// GRAPH
graph = new AmCharts.AmGraph();
graph.valueaxis = "ax1";
graph.type = "smoothedLine";
graph.lineColor = "#d1655d";
graph.negativeLineColor = "#637bb6";
graph.bullet = "square";
graph.bulletSize = 8;
graph.bulletBorderColor = "#FFFFFF";
graph.bulletBorderAlpha = 1;
graph.bulletBorderThickness = 2;
graph.lineThickness = 2;
graph.valueField = "v1";
graph.title = "title v1";
graph.balloonText = "[[category]]<br><b><span style='font-size:14px;'>[[value]]</span></b>";
chart.addGraph(graph);
graph2 = new AmCharts.AmGraph();
graph2.valueaxis = "ax2";
graph2.type = "smoothedLine";
graph2.lineColor = "#d1655d";
graph2.negativeLineColor = "#637bb6";
graph2.bullet = "round";
graph2.bulletSize = 8;
graph2.bulletBorderColor = "#FFFFFF";
graph2.bulletBorderAlpha = 1;
graph2.bulletBorderThickness = 2;
graph2.lineThickness = 2;
graph2.valueField = "v2";
graph2.title = "title v2";
graph2.balloonText = "[[category]]<br><b><span style='font-size:14px;'>[[value]]</span></b>";
chart.addGraph(graph2);
// CURSOR
var chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorAlpha = 0;
chartCursor.cursorPosition = "mouse";
chartCursor.categoryBalloonDateFormat = "YYYY";
chart.addChartCursor(chartCursor);
// SCROLLBAR
var chartScrollbar = new AmCharts.ChartScrollbar();
chart.addChartScrollbar(chartScrollbar);
chart.creditsPosition = "bottom-right";
// WRITE
chart.write("chartdiv");
});
有人遇到过类似的问题吗?如何克服这个问题?
最佳答案
一切都很简单,你打错了:
graph.valueaxis 应该是 graph.valueAxis
关于javascript - AmCharts 平滑线串行多 Y 轴未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21657200/
我刚刚编写了这些代码,但输出不同。第二个代码的输出符合我的预期,但第一个代码的输出不正确。但为什么呢? def fib(n): x = 0 y = 1 print x
#include #include #define CUBE(y)y*(y*y) main() { int j; j = CUBE(-2+4);
这个问题在这里已经有了答案: Multiple assignment and evaluation order in Python (11 个答案) 关闭 1 年前。 我看到下面的代码,但不知道它做
我正在阅读 book , 并讲了 typeclass Eq 的定义 有两个功能== , /=在等式中,它们被实现为: x == y = not (x /= y) x /= y = not (
我最近参加了一个代码力量竞赛。在比赛的编辑部分,我看到了按位运算符之间的一种美妙关系,即 x + y = x & y + x |是的我还不知道证据。我拿了几个数字来看看这个等式是否正确。我很高兴知道这
我使用 CGRectMake(x,x,x,x) 在我的 View 中放置了一个按钮,当然 x 是位置和大小。当我使用 -(BOOL)shouldAutoRotate... 旋转 View 时,我想将按
this.x = (Math.random()*canvasWidth); this.y = (Math.random()*canvasHeight); (1) this.shift = {x: th
我想将此代码运行为“if 'Britain' or 'UK' in string do stuff, but don't do stuff if "Ex UK" 在字符串中": #Case insen
早上好,我是新来的,我带来了一个小问题。我无法针对以下问题开发有效的算法:我需要找到三个正数 x、y 和 z 的组合,以便 x + y、x - y、y + z、y - z、x + z 和 x - z
我现在正在使用 C++ 编写方案的解释器。我有一个关于定义和 lambda 的问题。 (define (add x y) (+ x y)) 扩展为 (define add (lambda (x y)
我正在尝试使用一台主机通过 FTP 将内容上传到另一台主机。 “我不会打开到 172.xxx.xxx.xxx(仅到 54.xxx.xxx.xxx)的连接”甚至不相关,因为我没有连接到那个主持人。这是托
在 Python 中,使用 [] 解包函数调用有什么区别? , 与 ()还是一无所有? def f(): return 0, 1 a, b = f() # 1 [a, b] = f() # 2
给定方程 z = z(x,y) 2 个表面 I和 II : z_I(x, y) = a0 + a1*y + a2*x + a3*y**2 + a4*x**2 + a5*x*y z_II(x, y)
几年前我有这个面试问题,但我还没有找到答案。 x 和 y 应该是什么才能形成无限循环? while (x = y && x != y) { } 我们尝试了 Nan,infinity+/-,null f
我正在尝试使用 Camel FTP Producer 将文件发送到第三方 ftp 服务器(似乎由 Amazon 托管),但遇到了一个问题,写入文件失败,并显示:文件操作失败...主机尝试数据连接 x.
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 8 年前。 Improve t
我正在使用 torch.tensor.repeat() x = torch.tensor([[1, 2, 3], [4, 5, 6]]) period = x.size(1) repeats = [1
#include int main() { int x = 9; int y = 2; int z = x - (x / y) * y; printf("%d", z
我很难理解先有定义然后有两个异或表达式的含义。这个定义的作用是什么? 我尝试发送 x=8, y=7,结果是 x=15 和 y=8为什么会这样? 这是程序: #define FUNC(a,b) a^=b
我正在尝试使用 SIMD 优化此功能,但我不知道从哪里开始。 long sum(int x,int y) { return x*x*x+y*y*y; } 反汇编函数如下所示: 4007a0
我是一名优秀的程序员,十分优秀!