Upgrade from v1 to v3-Eval
Upgrade from v1 to v3-Eval
Hello there,
I'm already a customer with v1.
I'm trying to apply the V3 version to see the impacts in my systems and see if the correction's are ok. But, i'm get a black screen in my graph's and i don't know why. Basically, the only change i need to made in my graph call was the img.image() because it wait's for a Dimension class as parameter and my v1 expect int as width and height. Basically, i just put the new Dimension(w,h) into my img.image().
But i'm getting this result (see attachment bellow).
Edit: i'm sorry, i know that this is too much generic, but, i hope you guys could know what's going on.. thanks!
I'm already a customer with v1.
I'm trying to apply the V3 version to see the impacts in my systems and see if the correction's are ok. But, i'm get a black screen in my graph's and i don't know why. Basically, the only change i need to made in my graph call was the img.image() because it wait's for a Dimension class as parameter and my v1 expect int as width and height. Basically, i just put the new Dimension(w,h) into my img.image().
But i'm getting this result (see attachment bellow).
Edit: i'm sorry, i know that this is too much generic, but, i hope you guys could know what's going on.. thanks!
- Attachments
-
- Black Pie
- black_pie.png (204.84 KiB) Viewed 30474 times
Re: Upgrade from v1 to v3-Eval
Hi Lourival,
I'm afraid I don't remember hearing about something like this before.
Have you tried a new simple project to see if the component works as expected with a new chart?
The data isn't probably relevant here, so, assuming a new simple chart works fine, I'd try to add the code from your old application to this new chart to try to find what is the setting that seems to be causing this.
I'm afraid I don't remember hearing about something like this before.
Have you tried a new simple project to see if the component works as expected with a new chart?
The data isn't probably relevant here, so, assuming a new simple chart works fine, I'd try to add the code from your old application to this new chart to try to find what is the setting that seems to be causing this.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Upgrade from v1 to v3-Eval
Hello again Yeray,
I got a sample code from the forum and made a little change to export the graph to .jpg
Here is the code:
When you execute the code, you get a black image form it. But it still works in the frame for example. This is the problem that i have: It works in my V1, but not in the V3 evaluation copy.
Edit1: Forget about the name "pie". I was crazy in that moment
Edit2: Perhaps there's something missing before export to file.. But i don't know what it is...
Edit3: Here is the result:
I got a sample code from the forum and made a little change to export the graph to .jpg
Here is the code:
Code: Select all
public static void main(String[] args) throws IOException {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.setSize(600, 600);
TChart chart = new TChart();
panel.add(chart);
Bar b = new Bar(chart.getChart());
b.add(1.0, 10.0);
b.add(2.0, 20.0);
b.add(3.0, 30.0);
b.add(4.0, 40.0);
b.add(5.0, 0.0);
b.setMultiBar(MultiBars.STACKED);
b.setBarWidthPercent(100);
b.getMarks().setVisible(false);
boolean hasValue = true;
Bar b1 = new Bar(chart.getChart());
b1.add(1.0, 10.0);
if(hasValue){
b1.add(2.0, 0);
}else{
b1.add(2.0, 0, Color.TRANSPARENT);
}
b1.add(3.0, 30.0);
if(hasValue){
b1.add(4.0, 0);
}else{
b1.add(4.0, 0, Color.TRANSPARENT);
}
b1.add(5.0, 50.0);
b1.setMultiBar(MultiBars.STACKED);
b1.setBarWidthPercent(100);
int[] totalMarkCount = new int[b1.getCount()];
for(int i=0; i<b.getCount(); i++){
totalMarkCount[i] += b.getMarkValue(i);
}
for(int i=0; i<b1.getCount(); i++){
totalMarkCount[i] += b1.getMarkValue(i);
}
for(int i=0; i<totalMarkCount.length; i++){
System.out.println("total count: " + totalMarkCount[i]);
}
//move int to StringList
StringList labelList = new StringList(b1.getCount());
for(int i=0; i<b1.getCount(); i++){
labelList.add(i, Integer.toString(totalMarkCount[i]));
}
//reset new total count to b1
b1.setLabels(labelList);
chart.getAxes().getBottom().getLabels().setStyle(AxisLabelStyle.VALUE);
//set 2D
chart.getAspect().setView3D(false);
[b]ImageExport img = chart.getExport().getImage();
img.image(new Dimension(1024, 768));
img.getJPEG().save("C:/pie.jpg");[/b]
frame.add(panel);
frame.setSize(600, 600);
frame.setVisible(true);
}
Edit1: Forget about the name "pie". I was crazy in that moment
Edit2: Perhaps there's something missing before export to file.. But i don't know what it is...
Edit3: Here is the result:
- Attachments
-
- Result
- exportJPG.png (102.61 KiB) Viewed 30347 times
Re: Upgrade from v1 to v3-Eval
Hi Lourival,
In the meanwhile, using the chartPainted event works fine for me. You could substitute this in your code:
For this:
Yes, something like this. The problem is that the chart has to be drawn before being exported, and the getImage() function doesn't completely do it. I'm trying to find a function (update, repaint, refresh, validate,...) to force a chart repaint before the initial complete window drawing, but I can't find it.Lourival wrote:Perhaps there's something missing before export to file.. But i don't know what it is...
In the meanwhile, using the chartPainted event works fine for me. You could substitute this in your code:
Code: Select all
ImageExport img = chart.getExport().getImage();
img.image(new Dimension(1024, 768));
img.getJPEG().save("C:/pie.jpg");
Code: Select all
export = true;
tChart1.addChartPaintListener(new ChartPaintAdapter() {
@Override
public void chartPainted(ChartDrawEvent e) {
if (export) {
export = false;
ImageExport img = tChart1.getExport().getImage();
img.image(new Dimension(1024, 768));
try {
img.getJPEG().save("C:/pie.jpg");
} catch (IOException ex) {
Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
Glad to hear you're better now!Lourival wrote:Edit1: Forget about the name "pie". I was crazy in that moment
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Upgrade from v1 to v3-Eval
Hello again Yeray,
So, I understand that i need to get the image when chartPainted is called.
But, in my application, i need to to the getImage() and save the .jpg when my method of exportImageChart is called... I can't do it when the event is called...
something like this:
If i put the event, it's not guarantee that it'll be generated/saved in this time.
Am i missing something ?
So, I understand that i need to get the image when chartPainted is called.
But, in my application, i need to to the getImage() and save the .jpg when my method of exportImageChart is called... I can't do it when the event is called...
something like this:
Code: Select all
public String exportImageChart() {
String imageName = RandomGUID.newGUID();
File folder = new File(WFRConfig.reportsGeneratedDir());
folder.mkdirs();
File file = new File(WFRConfig.reportsGeneratedDir() + File.separatorChar + imageName + ".jpg");
String tmpName = file.getAbsolutePath();
try {
ImageExport img = chart.getExport().getImage();
img.image(new Dimension(Integer.parseInt(com.getProperty(ComponentProperty.TAMANHO)), Integer.parseInt(com.getProperty(ComponentProperty.ALTURA))));
img.getJPEG().save(tmpName);
} catch (IOException ex) {
logger.error(htmli.getUser(), sys.getCode(), ex);
}
tmpName = "WFRReports/Generated/" + imageName + ".jpg";
return tmpName;
}
Am i missing something ?
Re: Upgrade from v1 to v3-Eval
Hello,
The key is: is the exportImageChart method called before or after the form is shown?
- If it is called once the form has been shown, when a button is being pressed or something, you shouldn't find problems. So I don't think it's the case.
- If it is called before showing the form, the only way I've found to make it work is by using the event. The chartPainted event will be executed just when the form has finished the drawing process so the getImage() function returns a valid image.
However, you have to take care because calling getImage() into the chartPainted event without control would make an end-less loop. That's why I used a boolean ("export") to be sure the exportation is made only once.
The key is: is the exportImageChart method called before or after the form is shown?
- If it is called once the form has been shown, when a button is being pressed or something, you shouldn't find problems. So I don't think it's the case.
- If it is called before showing the form, the only way I've found to make it work is by using the event. The chartPainted event will be executed just when the form has finished the drawing process so the getImage() function returns a valid image.
However, you have to take care because calling getImage() into the chartPainted event without control would make an end-less loop. That's why I used a boolean ("export") to be sure the exportation is made only once.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Upgrade from v1 to v3-Eval
Ashley, there's no form: I always generate the graph in jpg files and present the .jpg file in my web application.The key is: is the exportImageChart method called before or after the form is shown?
As i said, there's no form: I just want to generate the picture of the graph into a file, and this method is my way to do it...- If it is called before showing the form, the only way I've found to make it work is by using the event. The chartPainted event will be executed just when the form has finished the drawing process so the getImage() function returns a valid image.
Yes, i realized that.However, you have to take care because calling getImage() into the chartPainted event without control would make an end-less loop. That's why I used a boolean ("export") to be sure the exportation is made only once.
Edit:
Another thing:
If you try this code:
And then, in the editor put a pizza graphic with data source with random (8 data for default) and go to "Export" menu (in the left side), you'll see that it generates an error.TChart tChart2 = new TChart();
ChartEditor.editChart(tChart2.getChart());
What i mean is, i build the graphic data and want to just export the .jpeg file. That's it: No forms. It always export the black image.
Re: Upgrade from v1 to v3-Eval
Hi Lourival,
In that case we'll have to try to find a way to make it work without forms. For it, it would be helpful if we could reproduce the very same environment you use (OS, IDE [if any], Java SDK version, TeeChart SWT/Swing,...). So could please arrange a simple example project we can run as-is here, and some simple instructions we can follow to build&execute it?
In that case we'll have to try to find a way to make it work without forms. For it, it would be helpful if we could reproduce the very same environment you use (OS, IDE [if any], Java SDK version, TeeChart SWT/Swing,...). So could please arrange a simple example project we can run as-is here, and some simple instructions we can follow to build&execute it?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Upgrade from v1 to v3-Eval
Sure,Yeray wrote:Hi Lourival,
In that case we'll have to try to find a way to make it work without forms. For it, it would be helpful if we could reproduce the very same environment you use (OS, IDE [if any], Java SDK version, TeeChart SWT/Swing,...). So could please arrange a simple example project we can run as-is here, and some simple instructions we can follow to build&execute it?
You can easily reproduce it by simple do the example of the other topic about the CircularGauge in this thread: http://www.teechart.net/support/viewtop ... 10&t=13328
Infos: Teechart - Swing v3 Eval - JDK 1.5
Code sample to reproduce the problem:
Code: Select all
package wfr;
import java.io.IOException;
import com.steema.teechart.Dimension;
import com.steema.teechart.TChart;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.exports.ImageExport;
import com.steema.teechart.styles.CircularGauge;
class Test {
static TChart chart1 = new TChart();
private static CircularGauge gaugeSeries1 = new CircularGauge(chart1.getChart());
static double dHigh = 8000;
static double dLow = 0;
public static void main(String[] args) throws IOException {
chart1.setText("");
chart1.setClipPoints(false);
chart1.getHeader().setVisible(false);
chart1.getLegend().setVisible(false);
chart1.getAspect().setView3D(false);
chart1.getAspect().setSmoothingMode(true);
chart1.getAspect().setTextSmooth(false);
chart1.getWalls().getBack().setTransparency(100);
gaugeSeries1.setMaximum(dHigh);
gaugeSeries1.setMinimum(dLow);
gaugeSeries1.clear();
double diff = dHigh - dLow;
chart1.getAxes().getLeft().setIncrement(diff / 10.0);
chart1.getAxes().getLeft().setMinMax(dLow, dHigh);
gaugeSeries1.getFrame().getOuterBand().setColor(Color.fromArgb(153, 153, 153));
gaugeSeries1.getFrame().getMiddleBand().getGradient().setVisible(true);
gaugeSeries1.getFrame().getMiddleBand().getGradient().setStartColor(Color.fromArgb(80, 80, 80));
gaugeSeries1.getFrame().getMiddleBand().getGradient().setEndColor(Color.WHITE);
gaugeSeries1.getFrame().getInnerBand().setColor(Color.fromArgb(213, 213, 213));
gaugeSeries1.setValue(3200);
ImageExport img = chart1.getExport().getImage();
img.image(new Dimension(1024, 768));
img.getJPEG().save("C:/graph.jpg");
}
}
Re: Upgrade from v1 to v3-Eval
Yeray,
Are you checking this for me ?
Are you checking this for me ?
Re: Upgrade from v1 to v3-Eval
Hi Lourival,
Yes, thanks for reporting it. We're are looking at it and we'll be back to you as soon as we find a way to achieve it.Lourival wrote:Are you checking this for me ?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Upgrade from v1 to v3-Eval
OK! Thanks Yeray,
I'll be waiting for a solution or workaround.
I'll be waiting for a solution or workaround.
Re: Upgrade from v1 to v3-Eval
Hi Lourival,
We've just found where was the problem and fixed it for the next maintenance release.
We've just found where was the problem and fixed it for the next maintenance release.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Upgrade from v1 to v3-Eval
Oh, great Yeray!Yeray wrote:Hi Lourival,
We've just found where was the problem and fixed it for the next maintenance release.
Is there a way to generate a beta version (of the evaluate version) with this patch so i can try into my application ? Or tell me when this version will be out...
Re: Upgrade from v1 to v3-Eval
Hi Lourival,
We expect to publish a new maintenance release shortly, evaluation version included.
We expect to publish a new maintenance release shortly, evaluation version included.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |