fusionCharts之标度尺
<div id="chartdiv1"></div>
<script src="/static/fusioncharts/FusionCharts.js"></script>
<script>
var xmldata = '<chart manageResize ="1" numberSuffix="元" caption="您认为下一个交易日的收盘价为:" editMode="1" upperLimit="9.54" lowerLimit="7.8" chartRightMargin="25"><colorRange><color minValue="7.8" maxValue="8.67" code="8BBA00" label="预测跌" /><color minValue="8.67" maxValue="9.54" code="FF0000" label="预测涨" /></colorRange><pointers><pointer id="x" value="8.77" toolText="预测价" /></pointers><trendpoints><point value="8.67" displayValue="昨收价" useMarker="1" markerTooltext="昨收价:8.67" fontcolor="FF4400" useMarker="0" markerRadius="5" color="FF654F" alpha="100" thickness="1" /></trendpoints><styles><definition><style type="font" name="labelFont" size="14" bgColor="FFFFFF" borderColor="999999"/> </definition><application><apply toObject="GAUGELABELS" styles="labelFont,myShadow"/></application></styles></chart>';
function FC_ChartUpdated(DOMId){
if (DOMId=="widget1"){
//Get reference to the chart
var chartRef = getChartFromId(DOMId);
//Get the current value
var pointerValue = chartRef.getData(1);
//You can also use getDataForId method as commented below, to get the pointer value.
//var pointerValue = chartRef.getDataForId("CS");
//Update display
var divToUpdateForGauge1 = document.getElementById("SliderSingle");
divToUpdateForGauge1.value = (pointerValue).toFixed(2);
}
}
function showChart_1() {
gauge1 = new FusionCharts("/static/fusioncharts/HLinearGauge.swf", "widget1", "640", "130", "0", "0");
gauge1.setDataXML(xmlData1);
gauge1.render("chartdiv1");
}
showChart_1();
</script>
效果如下:
<script src="/static/fusioncharts/FusionCharts.js"></script>
<script>
var xmldata = '<chart manageResize ="1" numberSuffix="元" caption="您认为下一个交易日的收盘价为:" editMode="1" upperLimit="9.54" lowerLimit="7.8" chartRightMargin="25"><colorRange><color minValue="7.8" maxValue="8.67" code="8BBA00" label="预测跌" /><color minValue="8.67" maxValue="9.54" code="FF0000" label="预测涨" /></colorRange><pointers><pointer id="x" value="8.77" toolText="预测价" /></pointers><trendpoints><point value="8.67" displayValue="昨收价" useMarker="1" markerTooltext="昨收价:8.67" fontcolor="FF4400" useMarker="0" markerRadius="5" color="FF654F" alpha="100" thickness="1" /></trendpoints><styles><definition><style type="font" name="labelFont" size="14" bgColor="FFFFFF" borderColor="999999"/> </definition><application><apply toObject="GAUGELABELS" styles="labelFont,myShadow"/></application></styles></chart>';
function FC_ChartUpdated(DOMId){
if (DOMId=="widget1"){
//Get reference to the chart
var chartRef = getChartFromId(DOMId);
//Get the current value
var pointerValue = chartRef.getData(1);
//You can also use getDataForId method as commented below, to get the pointer value.
//var pointerValue = chartRef.getDataForId("CS");
//Update display
var divToUpdateForGauge1 = document.getElementById("SliderSingle");
divToUpdateForGauge1.value = (pointerValue).toFixed(2);
}
}
function showChart_1() {
gauge1 = new FusionCharts("/static/fusioncharts/HLinearGauge.swf", "widget1", "640", "130", "0", "0");
gauge1.setDataXML(xmlData1);
gauge1.render("chartdiv1");
}
showChart_1();
</script>
效果如下: