📄 defaultintervalcategorydataset.html
字号:
<FONT color="green">614</FONT> * Returns a column index.<a name="line.614"></a><FONT color="green">615</FONT> *<a name="line.615"></a><FONT color="green">616</FONT> * @param columnKey the column key.<a name="line.616"></a><FONT color="green">617</FONT> *<a name="line.617"></a><FONT color="green">618</FONT> * @return The column index.<a name="line.618"></a><FONT color="green">619</FONT> */<a name="line.619"></a><FONT color="green">620</FONT> public int getColumnIndex(Comparable columnKey) {<a name="line.620"></a><FONT color="green">621</FONT> List categories = getCategories();<a name="line.621"></a><FONT color="green">622</FONT> return categories.indexOf(columnKey);<a name="line.622"></a><FONT color="green">623</FONT> }<a name="line.623"></a><FONT color="green">624</FONT> <a name="line.624"></a><FONT color="green">625</FONT> /**<a name="line.625"></a><FONT color="green">626</FONT> * Returns a row index.<a name="line.626"></a><FONT color="green">627</FONT> *<a name="line.627"></a><FONT color="green">628</FONT> * @param rowKey the row key.<a name="line.628"></a><FONT color="green">629</FONT> *<a name="line.629"></a><FONT color="green">630</FONT> * @return The row index.<a name="line.630"></a><FONT color="green">631</FONT> */<a name="line.631"></a><FONT color="green">632</FONT> public int getRowIndex(Comparable rowKey) {<a name="line.632"></a><FONT color="green">633</FONT> List seriesKeys = getSeries();<a name="line.633"></a><FONT color="green">634</FONT> return seriesKeys.indexOf(rowKey);<a name="line.634"></a><FONT color="green">635</FONT> }<a name="line.635"></a><FONT color="green">636</FONT> <a name="line.636"></a><FONT color="green">637</FONT> /**<a name="line.637"></a><FONT color="green">638</FONT> * Returns a list of the series in the dataset.<a name="line.638"></a><FONT color="green">639</FONT> * <P><a name="line.639"></a><FONT color="green">640</FONT> * Supports the CategoryDataset interface.<a name="line.640"></a><FONT color="green">641</FONT> *<a name="line.641"></a><FONT color="green">642</FONT> * @return A list of the series in the dataset.<a name="line.642"></a><FONT color="green">643</FONT> */<a name="line.643"></a><FONT color="green">644</FONT> public List getRowKeys() {<a name="line.644"></a><FONT color="green">645</FONT> // the CategoryDataset interface expects a list of series, but<a name="line.645"></a><FONT color="green">646</FONT> // we've stored them in an array...<a name="line.646"></a><FONT color="green">647</FONT> if (this.seriesKeys == null) {<a name="line.647"></a><FONT color="green">648</FONT> return new java.util.ArrayList();<a name="line.648"></a><FONT color="green">649</FONT> }<a name="line.649"></a><FONT color="green">650</FONT> else {<a name="line.650"></a><FONT color="green">651</FONT> return Collections.unmodifiableList(Arrays.asList(this.seriesKeys));<a name="line.651"></a><FONT color="green">652</FONT> }<a name="line.652"></a><FONT color="green">653</FONT> }<a name="line.653"></a><FONT color="green">654</FONT> <a name="line.654"></a><FONT color="green">655</FONT> /**<a name="line.655"></a><FONT color="green">656</FONT> * Returns the name of the specified series.<a name="line.656"></a><FONT color="green">657</FONT> *<a name="line.657"></a><FONT color="green">658</FONT> * @param row the index of the required row/series (zero-based).<a name="line.658"></a><FONT color="green">659</FONT> *<a name="line.659"></a><FONT color="green">660</FONT> * @return The name of the specified series.<a name="line.660"></a><FONT color="green">661</FONT> */<a name="line.661"></a><FONT color="green">662</FONT> public Comparable getRowKey(int row) {<a name="line.662"></a><FONT color="green">663</FONT> if ((row >= getRowCount()) || (row < 0)) {<a name="line.663"></a><FONT color="green">664</FONT> throw new IllegalArgumentException(<a name="line.664"></a><FONT color="green">665</FONT> "The 'row' argument is out of bounds.");<a name="line.665"></a><FONT color="green">666</FONT> }<a name="line.666"></a><FONT color="green">667</FONT> return this.seriesKeys[row];<a name="line.667"></a><FONT color="green">668</FONT> }<a name="line.668"></a><FONT color="green">669</FONT> <a name="line.669"></a><FONT color="green">670</FONT> /**<a name="line.670"></a><FONT color="green">671</FONT> * Returns the number of categories in the dataset. This method is part of <a name="line.671"></a><FONT color="green">672</FONT> * the {@link CategoryDataset} interface.<a name="line.672"></a><FONT color="green">673</FONT> *<a name="line.673"></a><FONT color="green">674</FONT> * @return The number of categories in the dataset.<a name="line.674"></a><FONT color="green">675</FONT> */<a name="line.675"></a><FONT color="green">676</FONT> public int getColumnCount() {<a name="line.676"></a><FONT color="green">677</FONT> int result = 0;<a name="line.677"></a><FONT color="green">678</FONT> if (this.startData != null) {<a name="line.678"></a><FONT color="green">679</FONT> if (getSeriesCount() > 0) {<a name="line.679"></a><FONT color="green">680</FONT> result = this.startData[0].length;<a name="line.680"></a><FONT color="green">681</FONT> }<a name="line.681"></a><FONT color="green">682</FONT> }<a name="line.682"></a><FONT color="green">683</FONT> return result;<a name="line.683"></a><FONT color="green">684</FONT> }<a name="line.684"></a><FONT color="green">685</FONT> <a name="line.685"></a><FONT color="green">686</FONT> /**<a name="line.686"></a><FONT color="green">687</FONT> * Returns the number of series in the dataset (possibly zero).<a name="line.687"></a><FONT color="green">688</FONT> *<a name="line.688"></a><FONT color="green">689</FONT> * @return The number of series in the dataset.<a name="line.689"></a><FONT color="green">690</FONT> */<a name="line.690"></a><FONT color="green">691</FONT> public int getRowCount() {<a name="line.691"></a><FONT color="green">692</FONT> int result = 0;<a name="line.692"></a><FONT color="green">693</FONT> if (this.startData != null) {<a name="line.693"></a><FONT color="green">694</FONT> result = this.startData.length;<a name="line.694"></a><FONT color="green">695</FONT> }<a name="line.695"></a><FONT color="green">696</FONT> return result;<a name="line.696"></a><FONT color="green">697</FONT> }<a name="line.697"></a><FONT color="green">698</FONT> <a name="line.698"></a><FONT color="green">699</FONT> }<a name="line.699"></a></PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -