1

My team is working on a graphing project that relates to market trading. We are hitting a road block with SWT's performance when we have to draw thousands of data points at a time. Are there any alternatives either within SWT or outside (such as openGL) that will give us a boost in the performance?

Extra information: We are designing within Eclipse RCP.

Edit: To clarify, these are dynamic charts not static.

Mike Depies
  • 777
  • 1
  • 6
  • 14
  • What kind of data points? How are you drawing them now? Have you tried some plotting or graph APIs? – Baz Sep 18 '12 at 18:11
  • Everything including pricebars, histograms, line charts, candlesticks and more. We have very specific requirements. Our logic inside is very sound, but the drawing operations themselves(either drawLine or drawPolyLine) seem to be too expensive when the dataset gets to large. taking around 100ms for 4000 data sets. – Mike Depies Sep 18 '12 at 18:16
  • Have you tried any of the charting libraries referenced here?: [Libraries for pretty charts in SWT?](http://stackoverflow.com/questions/22816/libraries-for-pretty-charts-in-swt) – Baz Sep 18 '12 at 18:18
  • We looked at them, but they are not really an option for us. While they are nice libraries, they do not allows us the flexibility we need. I'm more interested in what kind of results switching to openGL would provide or issues that we need to avoid in SWT drawing. – Mike Depies Sep 18 '12 at 18:23
  • Ps. These charts we are developing are dynamic charts. – Mike Depies Sep 18 '12 at 18:25
  • Sorry, don't know anything about openGL. My only guess for your bad performance would be, that the painting events are triggered too often. – Baz Sep 18 '12 at 18:27
  • Ok, thank you. Our paintEvents are being triggered properly, the issue lies in drawing that many pricebars for example at a given time. – Mike Depies Sep 18 '12 at 18:33
  • 100ms for rendering 4000 data samples sounds quite slow. I have ported pieces of AChartEngine to Swing and I was able to render several 10000s points in dynamic charts in less than that. Not sure what performance I could get in SWT, though. – Dan D. Sep 18 '12 at 18:38
  • In this case I'm drawing 4 lines for a pricebar for each data point. But I agree it is slow. – Mike Depies Sep 18 '12 at 18:47
  • So i guess in this case, I have 16000 drawing operations going on in ~100ms. I know this can be improved but seem to be at a dead end. – Mike Depies Sep 18 '12 at 18:49
  • I think SWT should render faster than Swing, but that may not happen in the 2d graphics world. – Dan D. Sep 18 '12 at 18:53
  • Shameless plug comment: QtJambi ? Qt framework with Java bindings. – Darryl Miles Sep 18 '12 at 19:49
  • Just an observation: drawRect is cheaper operation than drawing 4 lines.I just ran a test to draw same rectangle coordinates using drawline, drawRect and drawPolyline.(repeat 15000 times) drawline time taken: 84 ms drawrect time taken: 23 ms drawpolyline time taken: 38 ms – sambi reddy Sep 18 '12 at 20:22
  • but drawing a rect doesn't allow me to do price bars :) http://media.wiley.com/Lux/88/103788.image0.jpg I've experimented with drawPolyLine. DrawPoly is generally faster. But it still suffers with large(and 4000 isnt even large...) data sets. – Mike Depies Sep 18 '12 at 20:57
  • >4000 samples are visible at a time in the view or there is scrolling? if there is scrolling, draw only the pricelines that are allowed in visible bounds. – sambi reddy Sep 19 '12 at 00:52
  • visible at a time. I've been toying around with doing imageData manipulation. This gives extremely good results but it also means I have to "re-invent the wheel". – Mike Depies Sep 19 '12 at 01:20

1 Answers1

1

I ended up manipulating imageData to get the speed I needed. Building an image and then having it draw afterwards allows for a significant speed increase. Hope this helps anyone else that runs into this issue.

Mike Depies
  • 777
  • 1
  • 6
  • 14
  • Hi, Mike. I'm facing the same issue here. ImageData manipulating sounds promising but cumbersome. Feels like I'd have to reinvent the wheel. Would you share your discoveries? – Mario Marinato Apr 28 '17 at 17:03