📄 linerenderer3d.html
字号:
<FONT color="green">478</FONT> <a name="line.478"></a><FONT color="green">479</FONT> if (!getItemVisible(row, column)) {<a name="line.479"></a><FONT color="green">480</FONT> return; <a name="line.480"></a><FONT color="green">481</FONT> }<a name="line.481"></a><FONT color="green">482</FONT> <a name="line.482"></a><FONT color="green">483</FONT> // nothing is drawn for null...<a name="line.483"></a><FONT color="green">484</FONT> Number v = dataset.getValue(row, column);<a name="line.484"></a><FONT color="green">485</FONT> if (v == null) {<a name="line.485"></a><FONT color="green">486</FONT> return;<a name="line.486"></a><FONT color="green">487</FONT> }<a name="line.487"></a><FONT color="green">488</FONT> <a name="line.488"></a><FONT color="green">489</FONT> Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),<a name="line.489"></a><FONT color="green">490</FONT> dataArea.getY() + getYOffset(), <a name="line.490"></a><FONT color="green">491</FONT> dataArea.getWidth() - getXOffset(),<a name="line.491"></a><FONT color="green">492</FONT> dataArea.getHeight() - getYOffset());<a name="line.492"></a><FONT color="green">493</FONT> <a name="line.493"></a><FONT color="green">494</FONT> PlotOrientation orientation = plot.getOrientation();<a name="line.494"></a><FONT color="green">495</FONT> <a name="line.495"></a><FONT color="green">496</FONT> // current data point...<a name="line.496"></a><FONT color="green">497</FONT> double x1 = domainAxis.getCategoryMiddle(column, getColumnCount(), <a name="line.497"></a><FONT color="green">498</FONT> adjusted, plot.getDomainAxisEdge());<a name="line.498"></a><FONT color="green">499</FONT> double value = v.doubleValue();<a name="line.499"></a><FONT color="green">500</FONT> double y1 = rangeAxis.valueToJava2D(value, adjusted, <a name="line.500"></a><FONT color="green">501</FONT> plot.getRangeAxisEdge());<a name="line.501"></a><FONT color="green">502</FONT> <a name="line.502"></a><FONT color="green">503</FONT> Shape shape = getItemShape(row, column);<a name="line.503"></a><FONT color="green">504</FONT> if (orientation == PlotOrientation.HORIZONTAL) {<a name="line.504"></a><FONT color="green">505</FONT> shape = ShapeUtilities.createTranslatedShape(shape, y1, x1);<a name="line.505"></a><FONT color="green">506</FONT> }<a name="line.506"></a><FONT color="green">507</FONT> else if (orientation == PlotOrientation.VERTICAL) {<a name="line.507"></a><FONT color="green">508</FONT> shape = ShapeUtilities.createTranslatedShape(shape, x1, y1);<a name="line.508"></a><FONT color="green">509</FONT> }<a name="line.509"></a><FONT color="green">510</FONT> <a name="line.510"></a><FONT color="green">511</FONT> if (getItemLineVisible(row, column)) {<a name="line.511"></a><FONT color="green">512</FONT> if (column != 0) {<a name="line.512"></a><FONT color="green">513</FONT> <a name="line.513"></a><FONT color="green">514</FONT> Number previousValue = dataset.getValue(row, column - 1);<a name="line.514"></a><FONT color="green">515</FONT> if (previousValue != null) {<a name="line.515"></a><FONT color="green">516</FONT> <a name="line.516"></a><FONT color="green">517</FONT> // previous data point...<a name="line.517"></a><FONT color="green">518</FONT> double previous = previousValue.doubleValue();<a name="line.518"></a><FONT color="green">519</FONT> double x0 = domainAxis.getCategoryMiddle(column - 1, <a name="line.519"></a><FONT color="green">520</FONT> getColumnCount(), adjusted, <a name="line.520"></a><FONT color="green">521</FONT> plot.getDomainAxisEdge());<a name="line.521"></a><FONT color="green">522</FONT> double y0 = rangeAxis.valueToJava2D(previous, adjusted, <a name="line.522"></a><FONT color="green">523</FONT> plot.getRangeAxisEdge());<a name="line.523"></a><FONT color="green">524</FONT> <a name="line.524"></a><FONT color="green">525</FONT> double x2 = x0 + getXOffset();<a name="line.525"></a><FONT color="green">526</FONT> double y2 = y0 - getYOffset();<a name="line.526"></a><FONT color="green">527</FONT> double x3 = x1 + getXOffset();<a name="line.527"></a><FONT color="green">528</FONT> double y3 = y1 - getYOffset();<a name="line.528"></a><FONT color="green">529</FONT> <a name="line.529"></a><FONT color="green">530</FONT> GeneralPath clip = new GeneralPath();<a name="line.530"></a><FONT color="green">531</FONT> <a name="line.531"></a><FONT color="green">532</FONT> if (orientation == PlotOrientation.HORIZONTAL) {<a name="line.532"></a><FONT color="green">533</FONT> clip.moveTo((float) y0, (float) x0);<a name="line.533"></a><FONT color="green">534</FONT> clip.lineTo((float) y1, (float) x1);<a name="line.534"></a><FONT color="green">535</FONT> clip.lineTo((float) y3, (float) x3);<a name="line.535"></a><FONT color="green">536</FONT> clip.lineTo((float) y2, (float) x2);<a name="line.536"></a><FONT color="green">537</FONT> clip.lineTo((float) y0, (float) x0);<a name="line.537"></a><FONT color="green">538</FONT> clip.closePath();<a name="line.538"></a><FONT color="green">539</FONT> }<a name="line.539"></a><FONT color="green">540</FONT> else if (orientation == PlotOrientation.VERTICAL) {<a name="line.540"></a><FONT color="green">541</FONT> clip.moveTo((float) x0, (float) y0);<a name="line.541"></a><FONT color="green">542</FONT> clip.lineTo((float) x1, (float) y1);<a name="line.542"></a><FONT color="green">543</FONT> clip.lineTo((float) x3, (float) y3);<a name="line.543"></a><FONT color="green">544</FONT> clip.lineTo((float) x2, (float) y2);<a name="line.544"></a><FONT color="green">545</FONT> clip.lineTo((float) x0, (float) y0);<a name="line.545"></a><FONT color="green">546</FONT> clip.closePath();<a name="line.546"></a><FONT color="green">547</FONT> }<a name="line.547"></a><FONT color="green">548</FONT> <a name="line.548"></a><FONT color="green">549</FONT> g2.setPaint(getItemPaint(row, column));<a name="line.549"></a><FONT color="green">550</FONT> g2.fill(clip);<a name="line.550"></a><FONT color="green">551</FONT> g2.setStroke(getItemOutlineStroke(row, column));<a name="line.551"></a><FONT color="green">552</FONT> g2.setPaint(getItemOutlinePaint(row, column));<a name="line.552"></a><FONT color="green">553</FONT> g2.draw(clip);<a name="line.553"></a><FONT color="green">554</FONT> }<a name="line.554"></a><FONT color="green">555</FONT> }<a name="line.555"></a><FONT color="green">556</FONT> }<a name="line.556"></a><FONT color="green">557</FONT> <a name="line.557"></a><FONT color="green">558</FONT> // draw the item label if there is one...<a name="line.558"></a><FONT color="green">559</FONT> if (isItemLabelVisible(row, column)) {<a name="line.559"></a><FONT color="green">560</FONT> drawItemLabel(g2, orientation, dataset, row, column, x1, y1, <a name="line.560"></a><FONT color="green">561</FONT> (value < 0.0));<a name="line.561"></a><FONT color="green">562</FONT> }<a name="line.562"></a><FONT color="green">563</FONT> <a name="line.563"></a><FONT color="green">564</FONT> // add an item entity, if this information is being collected<a name="line.564"></a><FONT color="green">565</FONT> EntityCollection entities = state.getEntityCollection();<a name="line.565"></a><FONT color="green">566</FONT> if (entities != null) {<a name="line.566"></a><FONT color="green">567</FONT> addItemEntity(entities, dataset, row, column, shape);<a name="line.567"></a><FONT color="green">568</FONT> }<a name="line.568"></a><FONT color="green">569</FONT> <a name="line.569"></a><FONT color="green">570</FONT> }<a name="line.570"></a><FONT color="green">571</FONT> <a name="line.571"></a><FONT color="green">572</FONT> }<a name="line.572"></a></PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -