Easy chart renderer change is not reflecting

Hi All,

I tried changing the default renderer type (StandardXYItemRenderer) to XYStepRenderer as the value where plotted wrong in StandardXYItemRenderer. After changing the renderer type to XYStepRenderer the plotted graph is not changing its same as StandardXYItemRenderer. But intrestingly when i print the render its showing XYStepRenderer.

from org.jfree.chart import renderer
	from  org.jfree.chart.renderer.xy import XYStepRenderer
	from org.jfree.chart.renderer.xy import StandardXYItemRenderer

	
	plot = chart.getPlot()
	renderer = plot.getRenderer()
	print renderer
	print str(type(renderer))+"this was"
	renderer1 = XYStepRenderer()
	print type(renderer1)
	plot.setRenderer(renderer1)
	plot = chart.getPlot()
	renderer = plot.getRenderer()
	print str(type(renderer))+"this is it"
	print type(self)

output
org.jfree.chart.renderer.xy.StandardXYItemRenderer@7b027c09
<type ‘org.jfree.chart.renderer.xy.StandardXYItemRenderer’>this was
<type ‘org.jfree.chart.renderer.xy.XYStepRenderer’>
<type ‘org.jfree.chart.renderer.xy.XYStepRenderer’>this is it
<type ‘com.inductiveautomation.factorypmi.application.components.PMIEasyChart’>

But the output graph is the same as StandardXYItemRenderer
So I tried in the “chart” component surprisingly I am able to get the output there with the same code.
attached screenshot of both.

My question is
So why in an easy chart the chart is not changing to XYStepRenderer??

EASY chart:-
easy chart

Chart:-
chart

Where is this code running? If not called from the EasyChart’s configureChart method, I wouldn’t expect it to work.

Yes yes it’s running in the configured chart method only

Does your easy chart have subplots? The getPlot() call might be returning a CombinedDomainXYPlot or something similar, and each of its plots might need to have the renderer set. Or, you might need to assign the renderer to the correct series; it’s been a while since I’ve really gotten into JFreeChart.

2 Likes

Thanks for the input, But there is only one subplot to which the pen is assigned.
I tried the following

	plot = chart.getPlot()
	print plot.getPlotType()
	print plot.isSubplot()

Output:-
XY Plot
False