|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 | +<!--NewPage--> |
| 3 | +<HTML> |
| 4 | +<HEAD> |
| 5 | +<!-- Generated by javadoc (build 1.6.0_45) on Wed Aug 07 12:34:12 CEST 2013 --> |
| 6 | +<TITLE> |
| 7 | +CustomLabelFormatter |
| 8 | +</TITLE> |
| 9 | + |
| 10 | +<META NAME="date" CONTENT="2013-08-07"> |
| 11 | + |
| 12 | +<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> |
| 13 | + |
| 14 | +<SCRIPT type="text/javascript"> |
| 15 | +function windowTitle() |
| 16 | +{ |
| 17 | + if (location.href.indexOf('is-external=true') == -1) { |
| 18 | + parent.document.title="CustomLabelFormatter"; |
| 19 | + } |
| 20 | +} |
| 21 | +</SCRIPT> |
| 22 | +<NOSCRIPT> |
| 23 | +</NOSCRIPT> |
| 24 | + |
| 25 | +</HEAD> |
| 26 | + |
| 27 | +<BODY BGCOLOR="white" onload="windowTitle();"> |
| 28 | +<HR> |
| 29 | + |
| 30 | + |
| 31 | +<!-- ========= START OF TOP NAVBAR ======= --> |
| 32 | +<A NAME="navbar_top"><!-- --></A> |
| 33 | +<A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| 34 | +<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| 35 | +<TR> |
| 36 | +<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| 37 | +<A NAME="navbar_top_firstrow"><!-- --></A> |
| 38 | +<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| 39 | + <TR ALIGN="center" VALIGN="top"> |
| 40 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| 41 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| 42 | + <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| 43 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CustomLabelFormatter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| 44 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| 45 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| 46 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| 47 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| 48 | + </TR> |
| 49 | +</TABLE> |
| 50 | +</TD> |
| 51 | +<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| 52 | +</EM> |
| 53 | +</TD> |
| 54 | +</TR> |
| 55 | + |
| 56 | +<TR> |
| 57 | +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 58 | + <A HREF="../../../com/jjoe64/graphview/BarGraphView.html" title="class in com.jjoe64.graphview"><B>PREV CLASS</B></A> |
| 59 | + <A HREF="../../../com/jjoe64/graphview/GraphView.html" title="class in com.jjoe64.graphview"><B>NEXT CLASS</B></A></FONT></TD> |
| 60 | +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 61 | + <A HREF="../../../index.html?com/jjoe64/graphview/CustomLabelFormatter.html" target="_top"><B>FRAMES</B></A> |
| 62 | + <A HREF="CustomLabelFormatter.html" target="_top"><B>NO FRAMES</B></A> |
| 63 | + <SCRIPT type="text/javascript"> |
| 64 | + <!-- |
| 65 | + if(window==top) { |
| 66 | + document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| 67 | + } |
| 68 | + //--> |
| 69 | +</SCRIPT> |
| 70 | +<NOSCRIPT> |
| 71 | + <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> |
| 72 | +</NOSCRIPT> |
| 73 | + |
| 74 | + |
| 75 | +</FONT></TD> |
| 76 | +</TR> |
| 77 | +<TR> |
| 78 | +<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| 79 | + SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| 80 | +<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| 81 | +DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| 82 | +</TR> |
| 83 | +</TABLE> |
| 84 | +<A NAME="skip-navbar_top"></A> |
| 85 | +<!-- ========= END OF TOP NAVBAR ========= --> |
| 86 | + |
| 87 | +<HR> |
| 88 | +<!-- ======== START OF CLASS DATA ======== --> |
| 89 | +<H2> |
| 90 | +<FONT SIZE="-1"> |
| 91 | +com.jjoe64.graphview</FONT> |
| 92 | +<BR> |
| 93 | +Interface CustomLabelFormatter</H2> |
| 94 | +<HR> |
| 95 | +<DL> |
| 96 | +<DT><PRE>public interface <B>CustomLabelFormatter</B></DL> |
| 97 | +</PRE> |
| 98 | + |
| 99 | +<P> |
| 100 | +if you want to show different labels, |
| 101 | + you can use this label formatter. |
| 102 | + As Input you get the raw value (x or y) and |
| 103 | + you return a String that will be displayed. |
| 104 | + <code>graphView.setCustomLabelFormatter(new CustomLabelFormatter() { |
| 105 | + public String formatLabel(double value, boolean isValueX) { |
| 106 | + if (isValueX) { |
| 107 | + if (value < 5) { |
| 108 | + return "small"; |
| 109 | + } else if (value < 15) { |
| 110 | + return "middle"; |
| 111 | + } else { |
| 112 | + return "big"; |
| 113 | + } |
| 114 | + } |
| 115 | + return null; // let graphview generate Y-axis label for us |
| 116 | + } |
| 117 | + }); |
| 118 | + </code> |
| 119 | +<P> |
| 120 | + |
| 121 | +<P> |
| 122 | +<HR> |
| 123 | + |
| 124 | +<P> |
| 125 | + |
| 126 | +<!-- ========== METHOD SUMMARY =========== --> |
| 127 | + |
| 128 | +<A NAME="method_summary"><!-- --></A> |
| 129 | +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| 130 | +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| 131 | +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| 132 | +<B>Method Summary</B></FONT></TH> |
| 133 | +</TR> |
| 134 | +<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 135 | +<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| 136 | +<CODE> java.lang.String</CODE></FONT></TD> |
| 137 | +<TD><CODE><B><A HREF="../../../com/jjoe64/graphview/CustomLabelFormatter.html#formatLabel(double, boolean)">formatLabel</A></B>(double value, |
| 138 | + boolean isValueX)</CODE> |
| 139 | + |
| 140 | +<BR> |
| 141 | + will be called when the labels were generated</TD> |
| 142 | +</TR> |
| 143 | +</TABLE> |
| 144 | + |
| 145 | +<P> |
| 146 | + |
| 147 | +<!-- ============ METHOD DETAIL ========== --> |
| 148 | + |
| 149 | +<A NAME="method_detail"><!-- --></A> |
| 150 | +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| 151 | +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| 152 | +<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| 153 | +<B>Method Detail</B></FONT></TH> |
| 154 | +</TR> |
| 155 | +</TABLE> |
| 156 | + |
| 157 | +<A NAME="formatLabel(double, boolean)"><!-- --></A><H3> |
| 158 | +formatLabel</H3> |
| 159 | +<PRE> |
| 160 | +java.lang.String <B>formatLabel</B>(double value, |
| 161 | + boolean isValueX)</PRE> |
| 162 | +<DL> |
| 163 | +<DD>will be called when the labels were generated |
| 164 | +<P> |
| 165 | +<DD><DL> |
| 166 | +<DT><B>Parameters:</B><DD><CODE>value</CODE> - the raw input value (x or y)<DD><CODE>isValueX</CODE> - true if value is a x-value, false if otherwise |
| 167 | +<DT><B>Returns:</B><DD>the string that will be displayed. return null if you want graphview to generate the label for you.</DL> |
| 168 | +</DD> |
| 169 | +</DL> |
| 170 | +<!-- ========= END OF CLASS DATA ========= --> |
| 171 | +<HR> |
| 172 | + |
| 173 | + |
| 174 | +<!-- ======= START OF BOTTOM NAVBAR ====== --> |
| 175 | +<A NAME="navbar_bottom"><!-- --></A> |
| 176 | +<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| 177 | +<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| 178 | +<TR> |
| 179 | +<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| 180 | +<A NAME="navbar_bottom_firstrow"><!-- --></A> |
| 181 | +<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| 182 | + <TR ALIGN="center" VALIGN="top"> |
| 183 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| 184 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| 185 | + <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| 186 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CustomLabelFormatter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| 187 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| 188 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| 189 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| 190 | + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| 191 | + </TR> |
| 192 | +</TABLE> |
| 193 | +</TD> |
| 194 | +<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| 195 | +</EM> |
| 196 | +</TD> |
| 197 | +</TR> |
| 198 | + |
| 199 | +<TR> |
| 200 | +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 201 | + <A HREF="../../../com/jjoe64/graphview/BarGraphView.html" title="class in com.jjoe64.graphview"><B>PREV CLASS</B></A> |
| 202 | + <A HREF="../../../com/jjoe64/graphview/GraphView.html" title="class in com.jjoe64.graphview"><B>NEXT CLASS</B></A></FONT></TD> |
| 203 | +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 204 | + <A HREF="../../../index.html?com/jjoe64/graphview/CustomLabelFormatter.html" target="_top"><B>FRAMES</B></A> |
| 205 | + <A HREF="CustomLabelFormatter.html" target="_top"><B>NO FRAMES</B></A> |
| 206 | + <SCRIPT type="text/javascript"> |
| 207 | + <!-- |
| 208 | + if(window==top) { |
| 209 | + document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| 210 | + } |
| 211 | + //--> |
| 212 | +</SCRIPT> |
| 213 | +<NOSCRIPT> |
| 214 | + <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> |
| 215 | +</NOSCRIPT> |
| 216 | + |
| 217 | + |
| 218 | +</FONT></TD> |
| 219 | +</TR> |
| 220 | +<TR> |
| 221 | +<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| 222 | + SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| 223 | +<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| 224 | +DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| 225 | +</TR> |
| 226 | +</TABLE> |
| 227 | +<A NAME="skip-navbar_bottom"></A> |
| 228 | +<!-- ======== END OF BOTTOM NAVBAR ======= --> |
| 229 | + |
| 230 | +<HR> |
| 231 | + |
| 232 | +</BODY> |
| 233 | +</HTML> |
0 commit comments