2015-01-22 3 views
0

JChart2D에서 축 색을 변경하는 방법은 무엇입니까? ,JChart2D에서 축 색을 변경하는 방법

chart.setForeground(Color.BLUE); 

불행하게도이 모든 것을 변화 축 및 그리드 모두 :

지금까지 내가 찾은 가장 가까운 것은 같은 것이있다. 내가 찾고있는 것은 색이 다른 yAxis가 여러 개있는 것입니다.

어떻게 달성 할 수 있습니까?

답변

0

지금까지는 작동하지 않습니다. 오래 전에 기능 요청이있었습니다. http://sourceforge.net/p/jchart2d/feature-requests/51/

언제든지 투표를하거나 심지어 공헌 할 수 있습니다.

이 IAxis.java에서 이렇게하려면

+0

감사합니다. Achim, 투표 방법을 찾지 못했지만 패치를 만들려고합니다. 내가 성공하면 코드를 게시하여 다음 릴리스에 들어갈 수 있습니다. –

0

내가 수정 라이브러리를 컴파일 ...

종류와 관련, 아킴은 다음 코드는 AAxis.java에서

/** 
    * The property key defining the <code>color</code> property. Use in 
    * combination with 
    * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. 
    */ 
    public static final String PROPERTY_COLOR = "IAxis.PROPERTY_COLOR"; 

    /** 
    * Returns the color of the axis 
    * @return The chosen java.awt.Color or null if the decision for the color 
    *   should be made by the corresponding <code>Chart2D</code>. 
    */ 
    public Color getColor(); 

    /** 
    * Set a <code>java.awt.Color</code> for this axis. 
    * <p> 
    * 
    * @param color 
    *   the <tt>Color</tt> to set. 
    */ 
    public abstract void setColor(Color color); 

을 하였다 다음 코드가 추가되었습니다.

/** The color property. */ 
    private Color m_color = Color.black; 

    /** 
    * Get the <code>Color</code> this color will be painted with. 
    * <p> 
    * 
    * @return the <code>Color</code> of this instance 
    */ 
    public final Color getColor() { 
    return this.m_color; 
    } 

    /** 
    * <p> 
    * Set the <code>Color</code> this axis will be painted with. 
    * </p> 
    * 
    * @param color 
    *   the <code>Color</code> this trace will be painted with. 
    */ 
    public final void setColor(final Color color) { 
    final Color oldValue = this.m_color; 
    this.m_color = color; 
    if (!this.m_color.equals(oldValue)) { 
     this.m_propertyChangeSupport.firePropertyChange(IAxis.PROPERTY_COLOR, oldValue, this.m_color); 
    } 
    } 

마지막으로 두 가지 방법 라인 전에

g2d.setColor(this.getColor()); 

g2d.drawLine(xAxisLine, yAxisStart, xAxisLine, yAxisEnd); 

을 추가하십시오 : paintAxisYLeft 및 paintAxisYRight에서 수정 된

라인 전에

g2d.setColor(this.getColor()); 

를 추가

tickPainter.paintYTick(xAxisLine, tmp, label.isMajorTick(), true, g2d); 

호프 이것은 다음 릴리즈에 추가 될 수 있기를 바랍니다 ...

관련 문제