0

我在图表上方有带有指针的线性量规融合图表,其中指针值不断更新,我试图根据 xml 文件中的值定位指针,但我面临的问题是每次指针重新定位时,整个图表被刷新,我的要求是只重新定位指针,不应该刷新完整的图表,任何人都可以帮助实现此功能,我正在尝试按照以下链接http://www.fusioncharts中显示的示例进行操作.com/widgets/Gallery/Linear3.html

4

1 回答 1

2

您始终可以使用 JavaScript 或实时数据流更新线性仪表的指针值。

例如,假设您使用以下 XML 创建了图表:

<chart lowerLimit='0' upperLimit='100' lowerLimitDisplay='Bad' upperLimitDisplay='Good' palette='1' numberSuffix='%' chartRightMargin='20'>
   <colorRange>
      <color minValue='0' maxValue='75' code='FF654F' label='Bad'/>
      <color minValue='75' maxValue='90' code='F6BD0F' label='Moderate'/>
      <color minValue='90' maxValue='100' code='8BBA00' label='Good'/>
   </colorRange>
   <pointers>
      <pointer value='92' />
   </pointers>
</chart>

并且图表使用以下 JavaScript 呈现:

var myChart = new FusionCharts("Charts/HLinearGauge.swf", "myChartId", "450", "120", "0", "1");
myChart.setDataURL("Data/Linear3.xml");
myChart.render("chartdiv");

现在您可以使用以下 JavaScript 代码更新此图表:

getChartFromId("myChartId").setData(1, 20);

还有其他 API 函数,例如:setDataForId(Id, value) 或 feedData(updateDataQueryString)

例如,

getChartFromId("myChartId").setDataForId("p1", 40) ;// this requires the pointer to be set with an id which needs to be provided here as the first parameter 

或者

getChartFromId("myChartId").feedData("&value=90") ;

您也可以使用它来仅更新现有仪表的数据。

欲了解更多信息,请阅读: http ://www.fusioncharts.com/widgets/docs/Contents/Linear_JSPAPI.html

阅读有关如何使用服务器端实时数据流来更新仪表数据的更多信息: http ://www.fusioncharts.com/widgets/docs/Contents/Linear_RealTime.html

为此,您需要创建 dat 提供程序页面,其输出将是查询字符串格式的单行字符串,例如:&value=30

于 2011-09-20T19:23:51.923 回答