I am having difficulty setting the label for a chart's y-axis. I want the y-axis labels to show either "ON" or "OFF". The data I have is from a building management system, and it shows whether a device (air conditioner, security system) is on or off at a given time. What I wanted to show are multiple sensor states on top of each other. The data looks like:SensorID BinaryState Date-------- ----------- ----------------106 0 1/1/2005 0:00:00106 0 1/1/2005 1:00:00106 0 1/1/2005 2:00:00106 0 1/1/2005 3:00:00106 1 1/1/2005 4:00:00106 1 1/1/2005 5:00:0022 0 1/1/2005 0:00:0022 0 1/1/2005 1:00:0022 1 1/1/2005 2:00:0022 1 1/1/2005 3:00:0022 1 1/1/2005 4:00:0022 1 1/1/2005 5:00:0038 1 1/1/2005 0:00:0038 1 1/1/2005 1:00:0038 1 1/1/2005 2:00:0038 1 1/1/2005 3:00:0038 0 1/1/2005 4:00:0038 0 1/1/2005 5:00:00
Currently, in the y-axis format value, I have:=code.ShowLabel(fields!binarystate.value)
This is the code for ShowLabel()Function ShowLabel(byval i as integer) as string IF i mod 2 = 0 then return "OFF" Else return "ON" End IfEnd Function
I added a rownumber to each binary value (this way the line graph does not overlap) and used this value as the y-axis. The above code results in the y-axis displaying "OFF". If I change the ShowLabel() function to this:Function ShowLabel(byval i as integer) as string return "LINE: " & Cstr(i)End Function
The y-axis actually shows the correct value:LINE: 5LINE: 4LINE: 3LINE: 2LINE: 1Why is it that the code is not firing when I use mod as in previous example of showLabel(). Btw - the X-axis is the [date] the reading was taken.Any workarounds would be greatly appreciated.