Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [swtchart-dev] Buffering Chart Data via a Bitmap

Could you please create a demo and PR in "org.eclipse.swtchart.extensions.examples.charts" so that I'm able to inspect it.


Am 08.04.20 um 11:09 schrieb Yash Bharatiya:
I have implemented the interactive legend yesterday:
https://github.com/eclipse/swtchart/issues/137

Have you pulled all changes into your workspace?
yep.

Are you able to start it via the Eclipse run framework? 
I am currently using it via a driver main method
like-
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("sample");
shell.setSize(500, 400);
shell.setLayout(new FillLayout());
LineSeries_1_Part chart = new LineSeries_1_Part(shell);

BR,
Yash


On Wed, 8 Apr 2020 at 14:27, Philip Wenig <philip.wenig@xxxxxxxxxxxxx> wrote:
I have implemented the interactive legend yesterday:
https://github.com/eclipse/swtchart/issues/137

Have you pulled all changes into your workspace?

Are you able to start it via the Eclipse run framework?

Am 08.04.20 um 10:51 schrieb Yash Bharatiya:
Hi,
Are there any changes in code required when running sample parts with Extended Legend as they are throwing Null Pointer Exception
whenever being run as a Java Application?
LineSeries_4_Part chart=new LineSeries_4_Part(shell); //throws Null Pointer Exception.
Thanks,
Yash


On Wed, 8 Apr 2020 at 00:50, Philip Wenig <philip.wenig@xxxxxxxxxxxxx> wrote:
Hi Yash,

I have fixed the code, so that an image is drawn centered now:
baseChart.getPlotArea().setBackgroundImage(image);

https://github.com/eclipse/swtchart/issues/139


Best,
Philip

Am 07.04.20 um 09:16 schrieb Philip Wenig:
Hi Yash,

I'll have a look at the case today.


Best,
Philip

Am 07.04.20 um 09:10 schrieb Yash Bharatiya:
Hi,
I created the issue regarding the background image but I don't know a way to fix it,
Meanwhile I am using other ways to set background image-
public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("Step Chart");
		shell.setSize(500, 400);
		shell.setLayout(new FillLayout());
		// createChart(shell);
		LineSeries_3_Part chart = new LineSeries_3_Part(shell);
		LineSeries_3_Part chart2 = new LineSeries_3_Part(shell);
		chart.getBaseChart().getPlotArea().addCustomPaintListener(new ICustomPaintListener() {

			@Override
			public void paintControl(PaintEvent e) {

				ImageSupplier supplier = new ImageSupplier();
				Image image = new Image(display, supplier.getImageData(chart.getBaseChart()));
				Rectangle rect = image.getBounds();
				Rectangle rect2 = chart.getBaseChart().getBounds();
				final Image scaledGC200 = new Image(display, rect2.width, rect2.height);
				GC gc = new GC(scaledGC200);
				gc.drawImage(image, 0, 0, rect.width, rect.height, 0, 0, rect2.width, rect2.height);
				gc.dispose();
				e.gc.drawImage(scaledGC200, 0, 0, rect.width, rect.height, rect2.x - 100, rect2.y - 83, rect2.width, rect2.height);
			}
		});
		shell.open();
		while(!shell.isDisposed()) {
			if(!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}
I have attached a sample display of the above code -
the left one is the one with background and right one is normal.
Best,
Yash


On Thu, 2 Apr 2020 at 19:09, Philip Wenig <philip.wenig@xxxxxxxxxxxxx> wrote:
Hi Yash,

could you try to reproduce the error in the current Eclipse SWTChart code?
If it still persists, please create an issue:

https://github.com/eclipse/swtchart/issues

If you have PR for this issue, even better :-).


Best,
Philip

Am 01.04.20 um 21:08 schrieb Yash Bharatiya:
Hi,
Seems like there is a bug when using getPlotArea().getControl().setBackgroundImage(image) for SWTChart-
it states here that the image painted with org.eclipse.swt.widgets.Control.setBackgroundImage(Image) will be overlaid and hidden,
I have attached the file given to work around the bug
Best,
Yash


On Tue, 31 Mar 2020 at 11:14, Philip Wenig <philip.wenig@xxxxxxxxxxxxx> wrote:
Hi Yash,

via the chart settings, event processors can be defined. This makes it possible to completely changes the events of a chart. Three default actions are required to make the user selection:

org.eclipse.swtchart.extensions.core.ChartSettings

handledEventProcessors.add(new MouseDownEvent());
handledEventProcessors.add(new MouseMoveSelectionEvent());
handledEventProcessors.add(new MouseUpEvent());

The user selection is handled after mouse up event here:

org.eclipse.swtchart.extensions.core.BaseChart

private void handleUserSelectionXY(Event event) {

/*
 * Track the selection before the new range is
 * selected by the user.
 */
trackUndoSelection();
int xStart = userSelection.getStartX();
int xStop = userSelection.getStopX();
int yStart = userSelection.getStartY();
int yStop = userSelection.getStopY();
setSelectionXY(xStart, xStop, yStart, yStop);
trackRedoSelection();
/*
 * Inform all registered handlers.
 * Reset the current selection and redraw the chart.
 */
fireUpdateCustomRangeSelectionHandlers(event);
}


Best,
Philip


Am 31.03.20 um 07:32 schrieb Yash Bharatiya:
Hi,
I tried implementing the above mentioned idea and looked into the code base,
I used suspendUpdate() to lock the chart and the series plotting ,but I am having difficulty in understanding how the scrollable chart handles various events.
Could you briefly explain how event handling is done in the scrollable chart.

Thanks,
Yash


On Sat, 28 Mar 2020 at 10:27, Philip Wenig <philip.wenig@xxxxxxxxxxxxx> wrote:
Hi Yash,

yep, that's idea. I have the following workflow in mind:

1) start zoom action
2) lock the chart and disable series plotting
3) convert current chart (BaseChart) to an image (png) via the image supplier)
4) set the image: getPlotArea().getControl().setBackgroundImage(image)
5) let the user select the range
6) stop zoom action
7) clear the image: getPlotArea().getControl().setBackgroundImage(null);
8) enable series plotting
9) unlock the chart
10) redraw

Creating the image should be relatively fast as the plot is drawn already and thus the display is available. We should give this idea a try.


Best,
Philip



Am 28.03.20 um 05:09 schrieb Yash Bharatiya:
Hi,
Currently SWTChart redraws everytime the user zooms in or out causing performance issues,

Does that mean the chart will be converted into a graphic image and then scaled or resized whenever zoomed in or out instead of redrawing?
The chart can be converted into an image using ImageSupplier class,
ImageSupplier imageSupplier = new ImageSupplier();
ImageData imageData = imageSupplier.getImageData(scrollableChart.getBaseChart());
Image image=new Image(display,imageData);
Thanks,
Yash

_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

_______________________________________________
swtchart-dev mailing list
swtchart-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/swtchart-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~

Back to the top