Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从组到带RGRAPHE的堆叠图形,y轴不';不变_Javascript_Html_Charts_Bar Chart_Rgraph - Fatal编程技术网

Javascript 从组到带RGRAPHE的堆叠图形,y轴不';不变

Javascript 从组到带RGRAPHE的堆叠图形,y轴不';不变,javascript,html,charts,bar-chart,rgraph,Javascript,Html,Charts,Bar Chart,Rgraph,我一直在四处寻找,找不到答案,我不认为这是一个困难的解决方案,但我不知道怎么做 我用RGraph绘制了一个分组条形图。这是通过以下代码完成的: var tooltip = createToolTip(); bar4 = new RGraph.Bar('graph_tab1', objectSoap1.getValue()); bar4.Set('chart.colors', ['Gradient(#c01:red)', 'Gradient(#05D:blue)', 'Gradient

我一直在四处寻找,找不到答案,我不认为这是一个困难的解决方案,但我不知道怎么做

我用RGraph绘制了一个分组条形图。这是通过以下代码完成的:

  var tooltip = createToolTip();
  bar4 = new RGraph.Bar('graph_tab1', objectSoap1.getValue());
  bar4.Set('chart.colors', ['Gradient(#c01:red)', 'Gradient(#05D:blue)', 'Gradient(#0f0:green)', 'Gradient(#f0f:pink)']); 
  bar4.Set('chart.labels', objectSoap1.getLabel());
  bar4.Set('chart.numyticks', 8);
  bar4.Set('chart.ylabels.count', 6);
  bar4.Set('chart.variant', '2d');
  bar4.Set('chart.strokestyle', 'rgba(0,0,0,0)');
  bar4.Set('chart.hmargin.grouped', 0);
  bar4.Set('chart.background.grid.autofit.numhlines', 6);
  RGraph.Effects.Bar.Grow(bar4);
  bar4.Set('chart.grouping', 'stacked')
  RGraph.Effects.Bar.Grow(bar4);
现在,如果我按下一个按钮,它必须从分组变为堆叠。我使用以下代码执行此操作:

  var tooltip = createToolTip();
  bar4 = new RGraph.Bar('graph_tab1', objectSoap1.getValue());
  bar4.Set('chart.colors', ['Gradient(#c01:red)', 'Gradient(#05D:blue)', 'Gradient(#0f0:green)', 'Gradient(#f0f:pink)']); 
  bar4.Set('chart.labels', objectSoap1.getLabel());
  bar4.Set('chart.numyticks', 8);
  bar4.Set('chart.ylabels.count', 6);
  bar4.Set('chart.variant', '2d');
  bar4.Set('chart.strokestyle', 'rgba(0,0,0,0)');
  bar4.Set('chart.hmargin.grouped', 0);
  bar4.Set('chart.background.grid.autofit.numhlines', 6);
  RGraph.Effects.Bar.Grow(bar4);
  bar4.Set('chart.grouping', 'stacked')
  RGraph.Effects.Bar.Grow(bar4);
它绘制了一个叠加图。。但问题是y轴不会改变

例如,如果我有一个分组条形图,其值为5、10和15。最大y值为15。 但是如果我叠加这些值,值将是30,通过这段代码,条形图将增长到很远,因为它的值将是30,y轴只会是15


我希望我的意思很清楚,有人能帮助我。

这里有一个从分组切换到堆叠的例子:


谢谢您的回复。谢谢你的例子。这将有助于该链接不幸受密码保护(=已死亡),它也有三年历史,不再存在,可能不再准确。在论坛上提问。