New SeriesRegion tool for TeeChart Java

The majority of TeeChart versions already include a tool called SeriesRegion; the time for TeeChart Java to make a step forward has arrived!

To make this tool available you only have to include the according import:

import com.steema.teechart.tools.SeriesRegion;

Then, to use it you only need a chart and a series to link it:

Line line1 = new Line(chart1.getChart());
line1.fillSampleValues(20);

SeriesRegion seriesRegionTool1 = new SeriesRegion(chart1.getChart());
seriesRegionTool1.setSeries(line1);

Other properties this tool includes are AutoBound, UseOrigin, Origin, LowerBound, UpperBound and DrawBehindSeries. You can use the getters and setters to retrieve or set their values. Here a short description of their purpose:

  • AutoBound: If true, region left and right bounds are equal to series minimum and maximum x value.
  • Origin: Region bottom or upper limit. Used only if UseOrigin is true.
  • UseOrigin: If true, region bottom or upper limit is defined by Origin.
  • LowerBound: Defines region left (series not mandatory values) lower bound.
  • UpperBound: Defines region right (series not mandatory values) upper bound.
  • DrawBehindSeries: If true, draw region behind series. If false, draw region over series.

Also note you can access its Brush and Pen like with the other tools inheriting from Tool class.

Playing with this tool and its properties, you can get something like in the image below, extracted from the Features Demo:

SeriesRegion

This tool and the respective demos will be included with the next maintenance release of TeeChart Java (both Swing and SWT) and TeeChart Java for Android.

Converting VCL/FMX and ActiveX templates to .NET.

Over the years, a number of TeeChart users have asked how to convert the charts they created either using TeeChart VCL/FMX or ActiveX to the .NET version, enabling them to more easily port their previously created charting projects to .NET.

Well, this is possible! It might not be the ideal or perfect solution but it’s an approximation that can save you some work. This can be achieved in two ways:

  1. Using the TeeToTen application. It is a .NET application that uses TeeChart ActiveX to load the .tee files (TeeChart VCL/FMX and ActiveX templates), convert them to text files, generate an XML file with series and data and then load them into a .NET chart  which is then used to generate the .ten file (TeeChart .NET templates) file. The tool comes with a readme.txt document that explains which are its prerequisites and how to use it. TeeToTen tool can also be called via command line with several parameter options. This way it can be called from your applications to obtain a completely automatic conversion. Full details on how to use it are available at included readme.txt.
  2. This solution by-passes the ActiveX version and uses TeeToText, a small VCL application that loads .tee files and generates the necessary text and XML files. Actually, anybody that uses TeeChart VCL/FMX or TeeChart ActiveX can easily generate such files using their built in exporting functionalty, which is what TeeToText does. Once the process is complete,  you need to use TenCreator.dll included with TeeToTen  to import these generated files into your .NET chart. Here’s an example of TenCreator.dll being used to convert one file:
1
2
3
4
5
6
7
8
string chartFile = @"C:\temp\TemplateSamples\Annotations.txt";
string dataFile = @"C:\temp\TemplateSamples\Annotations.xml";
 
TenCreator.TenStreamer streamer = new TenCreator.TenStreamer();
System.IO.Stream netStream = streamer.ConvertFile(chartFile, dataFile);
netStream.Position = 0;
tChart1.Import.Template.Load(netStream);
tChart1.Export.Template.Save(@"C:\TemplateSamples\Annotations.ten");
string chartFile = @"C:\temp\TemplateSamples\Annotations.txt";
string dataFile = @"C:\temp\TemplateSamples\Annotations.xml";

TenCreator.TenStreamer streamer = new TenCreator.TenStreamer();
System.IO.Stream netStream = streamer.ConvertFile(chartFile, dataFile);
netStream.Position = 0;
tChart1.Import.Template.Load(netStream);
tChart1.Export.Template.Save(@"C:\TemplateSamples\Annotations.ten");

and here’s an example converting a complete folder:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public Form1()
{
InitializeComponent();
InitializeChart();
}
 
private void InitializeChart()
{
DirectoryInfo dFolder = new DirectoryInfo(@"C:\TemplateSamples\");
SearchOption so = new SearchOption();
bool incSubDirectories = false;
 
if (incSubDirectories)
{
so = SearchOption.AllDirectories;
}
else
{
so = SearchOption.TopDirectoryOnly;
}
 
FileInfo[] fFileArray = dFolder.GetFiles("*.tee", so);
 
foreach (FileInfo fFile in fFileArray)
{
ConvertFile(fFile.FullName);
}
}
 
private void ConvertFile(string fileName)
{
string chartFile = fileName.Replace(".tee", ".txt");
string dataFile = fileName.Replace(".tee", ".xml");
 
TenCreator.TenStreamer streamer = new TenCreator.TenStreamer();
Stream netStream = streamer.ConvertFile(chartFile, dataFile);
netStream.Position = 0;
tChart1.Import.Template.Load(netStream);
tChart1.Export.Template.Save(fileName.Replace(".tee", ".ten"));
}
public Form1()
{
InitializeComponent();
InitializeChart();
}

private void InitializeChart()
{
DirectoryInfo dFolder = new DirectoryInfo(@"C:\TemplateSamples\");
SearchOption so = new SearchOption();
bool incSubDirectories = false;

if (incSubDirectories)
{
so = SearchOption.AllDirectories;
}
else
{
so = SearchOption.TopDirectoryOnly;
}

FileInfo[] fFileArray = dFolder.GetFiles("*.tee", so);

foreach (FileInfo fFile in fFileArray)
{
ConvertFile(fFile.FullName);
}
}

private void ConvertFile(string fileName)
{
string chartFile = fileName.Replace(".tee", ".txt");
string dataFile = fileName.Replace(".tee", ".xml");

TenCreator.TenStreamer streamer = new TenCreator.TenStreamer();
Stream netStream = streamer.ConvertFile(chartFile, dataFile);
netStream.Position = 0;
tChart1.Import.Template.Load(netStream);
tChart1.Export.Template.Save(fileName.Replace(".tee", ".ten"));
}

This project is a work in progress. It’s being improved upon user demand so feel free to let us know your feedback at info at steema dot com.  We hope this helps in the transition of your existing projects that use TeeChart to the .NET platform.

 

TeeChart WPFDirect2D Beta

wpfvswpfdirect2D
Screenshot of FastLineWPF_Speed demo app

I’m pretty excited to announce the public availability of TeeChart.WPFDirect2D.dll, a new assembly in the TeeChart for .NET family. This assembly functions with SlimDX to produce a seamless Direct2D experience within the WPF framework, producing increases of rendering performance by at least a factor of two (>=200%). The binary version of a demo app which includes the TeeChart.WPFDirect2D.dll can be downloaded from here, while the source code for that same demo is available here.