Afternoon All,
If I understand correctly, the options under the "Other" tab on the chart properties are not all currently implemented. Is there a way to remove the "Series" options from this tab?
Thank you,
Andy
Removing Chart Properties Options.
-
- Posts: 47
- Joined: Thu Dec 11, 2008 7:59 pm
Re: Removing Chart Properties Options.
JFreeChart has a built in chart editor that comes up when you right click on a chart and select Properties. The current chart editor is very basic, but you can replace it with your own. See my post here on how to create your own chart editor: http://www.jfree.org/phpBB2/viewtopic.php?p=74702#74702
In your case, all you need to do is edit DefaultChartEditor.java, which contains the stuff on the Other tab.
In your case, all you need to do is edit DefaultChartEditor.java, which contains the stuff on the Other tab.
Re: Removing Chart Properties Options.
I downloaded the source, modified it, and re-compiled it. Thank you. I didn't want to have to do that becuase it causes more maintenance with staying up-to-date, but it solved my problem. Any idea with those might be implemented?
Thank you again for you help,
Andy
Thank you again for you help,
Andy
-
- Posts: 47
- Joined: Thu Dec 11, 2008 7:59 pm
Re: Removing Chart Properties Options.
Having your own copy of a ChartEditor that is independent of updates to the built in ChartEditor is the only downside to my approach (that I know of). However, now that the basic framework is down, you can get clever and start replacing the My stuff back to Default stuff. The only file you needed to change was DefaultChartEditor.java because it contains the Other tab. Everything else can now revert back to the built in Default stuff.
For example, to get back the built in DefaultTitleEditor and DefaultPlotEditor, simply revert these lines in DefaultChartEditor:
Or, if you're feeling lucky, you can continue to use the DefaultChartEditor and then dynamically edit the panel inside your ChartEditorFactory. For example:
That's all I can think of so far. Hopefully someone more clever than I can come up with something better. But atleast you have access to the JPanel you want to edit, just need to add in the logic to remove the stuff.
For example, to get back the built in DefaultTitleEditor and DefaultPlotEditor, simply revert these lines in DefaultChartEditor:
Code: Select all
this.titleEditor = new DefaultTitleEditor(title);
this.plotEditor = new DefaultPlotEditor(plot);
Code: Select all
package my.java.app.myeditor;
import org.jfree.chart.*;
import org.jfree.chart.editor.*;
/**
* My implementation of the ChartEditorFactory interface.
*/
public class MyChartEditorFactory implements ChartEditorFactory
{
/**
* Creates a new instance.
*/
public MyChartEditorFactory()
{
}
/**
* Returns a new instance of a ChartEditor.
*
* @param chart the chart.
*
* @return A chart editor for the given chart.
*/
public ChartEditor createEditor(JFreeChart chart)
{
ChartEditor chartEditor = new DefaultChartEditor(chart);
// chartEditor extends JPanel, so utilize JPanel methods to manipulate the UI before it is shown
chartEditor.getComponent...
return chartEditor;
}
}