Sign in to follow this  
Guest Madhumita

Dynamic yAxisMaxValue

Recommended Posts

Hi,

Is it possible to set Dynamic yAxisMaxValue or yAxisMinValue in realtime chart.

Say we want to set 10% of lowest value for yAxisMinValue and 20% of yAxisMaxValue. How?

Awiting your reply.

Regards,

Bagus Sutan

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello Bagus,

FusionWidgets does not natively support this.

As an alternative, you can use JavaScript to do the same.

1. Find out the max and min values from the data sent.

2. Calculate the max and min values you wish to set.

3. Set the Max and Min values in the <chart> element.

4. Use the setDataXML function to update the chart.

I hope this helps you. :)

 

Share this post


Link to post
Share on other sites

Hello Madhumita,

for your info i have code like this:

chartStag.setDataXML("<chart  dataStreamURL='" + escape('realtimedatatag.asp?tagname=<%=stagname%>') + "' yAxisMaxValue='?' yAxisMinValue='?'   refreshInterval='1'  updateInterval='1' lineThickness='1' canvasBgAlpha='100'  bgColor='000000' bgAlpha='100' canvasBorderThickness='1' canvasBorderColor='57b746' canvasBgColor='000000' decimals='2' numdivlines='15' numVDivLines='10' numDisplaySets='300' divLineColor='003300' vDivLineColor='003300' divLineAlpha='100' chartLeftMargin='20' baseFontColor='00FF00' showRealTimeValue='0' labelDisplay='rotate' slantLabels='1' toolTipBgColor='000000' toolTipBorderColor='008040' baseFontSize='10' showAlternateHGridColor='0' legendBgAlpha='0'legendBgColor='000000'  legendPadding='35' showLabels='0' caption='SCADA Historical Trends' subCaption='<%=stagname%>'  legendBorderColor='57b746' legendAllowDrag='0' toolTipBorderColor='57b746'  drawAnchors='0' anchorRadius='0.5' numberPrefix='' setAdaptiveYMin='1' xAxisName='' showNames='0'  showRealTimeValue='0' realTimeValuePadding='50' labelDisplay='Rotate' slantLabels='1' ><categories ></categories><dataset seriesName='<%=stagname%>' showValues='0' ></dataset><styles><definition><style type='font' name='captionFont' size='14' /></definition><application><apply toObject='Caption' styles='captionFont' /><apply toObject='Realtimevalue' styles='captionFont' /></application></styles></chart>");

  chartStag.render("chartStag");

and for 'realtimedatatag.asp' as this:

<%

 dim tagname

 tagname=request("tagname")

 set connT=server.CreateObject ("adodb.connection")

 connectT = "Provider=HwPHDProv.2;User ID=;Data Source=TENOPC41;Extended Properties=;Persist Security Info=False"

 on error resume next

 connT.Open connectT

 

 Set oRsT=Server.CreateObject("adodb.recordset")

strSQLT = "SELECT * FROM IP_PHD_DATA WHERE TAGNAME = '"& tagname &"' AND SMPLINT()=1 AND TIMESTAMP='NOW'"

oRsT.Open strSQLT, connT

 

 do while not oRsT.eof  

x =oRsT("timestamp") 

y=oRsT("value")

oRsT.movenext

 loop

 Response.Write("&label="& x & "&value=" & y  )

 

%>

 

How can I supply 10% the lowest value to yAxisMinValue and 20% the highest value to yAxisMaxValue. I'would really appreciate your help. Thanks.

Regards,

Bagus Sutan 

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello Bagus,

Please note that for a real-time widget before JavaScript does anything, the data will be updated and then the axis will be the default one. After JavaScript works on the data then only the axes are updated. This solution thus will not be feasible as the chart will be updated with the same value twice.

If you have the soure codes you can always set the yaxis max and min value according to your needs by customising the codes.

Edited by Guest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this