|
How to set StepLine labels on Yaxis2() |
Posted by Ramesh on Apr-02-2009 02:27 |
|
Hi,
I need to develop a control chart on which I've to plot control limit lines as steplines. I'm able to do that by adding Steplinelayer. However, I'm unable to add labels on the right side (yaxis2()) of the chart. the label is last value of the data array with which i drew stepline layer.
Can anybody help me in this regard?
piece of code is as follows:
chart.addStepLineLayer(_uwlLine, Chart.CColor(Color.Yellow));
chart.addStepLineLayer(_clLine, Chart.CColor(Color.Blue));
chart.addStepLineLayer(_lwlLine, Chart.CColor(Color.Yellow));
chart.addStepLineLayer(_lrlLine, Chart.CColor(Color.Purple));
chart.addStepLineLayer(_urlLine, Chart.CColor(Color.Purple));
chart.addStepLineLayer(_uclLine, Chart.CColor(Color.Red));
chart.addStepLineLayer(_lclLine, Chart.CColor(Color.Red)); |
Re: How to set StepLine labels on Yaxis2() |
Posted by Peter Kwan on Apr-02-2009 21:59 |
|
Hi Ramesh,
You may use something like (assuming Java code):
c.syncAxis();
c.yAxis2().setLabelFormat("");
c.yAxis().addMark(_uwlLine[_uwlLine.length - 1], -1, "" + _uwlLine[_uwlLine.length - 1]).setMarkColor(Chart.Transparent, 0x000000);
c.yAxis().addMark(_clLine[_clLine.length - 1], -1, "" + _clLine[_clLine.length - 1]).setMarkColor(Chart.Transparent, 0x000000);
(If you are using C# instead of Java, please change ".length" to ".Length".)
Hope this can help.
Regards
Peter Kwan |
Re: How to set StepLine labels on Yaxis2() |
Posted by Ramesh on Apr-03-2009 00:03 |
|
Peter,
That's awesome!!! I was trying with yaxis2().addmark where color of the mark is white. But, your ides is too good. its working.Thanks a lot.
Will disturb you again, if i've any questions.
Thanks
Ramesh |
Re: How to set StepLine labels on Yaxis2() |
Posted by Ramesh on May-10-2009 01:28 |
|
Hi Peter,
The solution you gave me worked in Dot Net 2.0(VS2005). When i used the same piece of code in VS2003(Dot Net1.1) its showing all the labels on the yaxis2 instead it should only show mentioned limits
Code is like this
'Labels on the right side of the chart
LimitGraph.syncYAxis()
LimitGraph.yAxis2().setLabelFormat("")
LimitGraph.yAxis2().addMark(URL, -1, "URL=" + Convert.ToString(URL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(UWL, -1, "UWL=" + Convert.ToString(UWL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(LWL, -1, "LWL=" + Convert.ToString(LWL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(LRL, -1, "LRL=" + Convert.ToString(LRL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(TGT, -1, "TGT=" + Convert.ToString(TGT)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(UCL, -1, "UCL=" + Convert.ToString(UCL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(LCL, -1, "LCL=" + Convert.ToString(LCL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(UUL, -1, "UUL=" + Convert.ToString(UUL)).setMarkColor(Chart.Transparent, 0)
LimitGraph.yAxis2().addMark(LUL, -1, "LUL=" + Convert.ToString(LUL)).setMarkColor(Chart.Transparent, 0)
The above piece of code should show only URL,LRL,..... but its showing all the labels that are there on Yaxis along with all the above values....
What could be the reason. Please help me.
Thanks
Ramesh |
Re: How to set StepLine labels on Yaxis2() |
Posted by Peter Kwan on May-12-2009 00:39 |
|
Hi Ramesh,
Are your entire code exactly the same in VS 2005 and VS 2003, or are they different?
If the other parts of the code are different, is it possible you may have other code in your project that makes the output different? For example, there may be another line somewhere in your code that re-enables the default right y-axis labels.
In addition to LimitGraph.yAxis2().setLabelFormat(""), another method to hide the y-axis labels is to set the label color to transparent, like:
'assume VB.NET code
LimitGraph.yAxis2().setColors(&H000000, Chart.Transparent, &H000000, Chart.Transparent)
Hope this can help.
Regards
Peter Kwan |
Re: How to set StepLine labels on Yaxis2() |
Posted by Ramesh on May-12-2009 00:50 |
|
Hi Peter,
I just copied and pasted
"LimitGraph.yAxis2().setColors(&H000000, Chart.Transparent, &H000000, Chart.Transparent)"
and it did magic. I Don't know why setLabelFormat("") is not working in VS2003. The only difference is in VS2005 its CSharp code and in VS2003 its VB code.
May be that is the reason.
I'm feeling lucky
you are so cool.
Thanks Alot
Ramesh |
|