Page 1 of 1

Polar Series

Posted: Thu Jul 17, 2014 12:52 pm
by 16568742
I am trying to create a chart that is sort of a cross between a polar plot and a color grid. Is this possible?

It would look like this...
PolarColorSeries.jpg
PolarColorSeries.jpg (151.22 KiB) Viewed 19679 times
It was created from a TColorGridSeries that Looks like this...
TColorGridSeries.jpg
TColorGridSeries.jpg (147.82 KiB) Viewed 19665 times

Re: Polar Series

Posted: Thu Jul 17, 2014 1:08 pm
by narcis
Hi dpatch,

Sure! There's a specific series for that, the PolarGrid series? You can find an example at All Features\Welcome!\Chart Styles\Extended\Polar Grid.

Re: Polar Series

Posted: Thu Jul 17, 2014 4:42 pm
by 16568742
Thanks for the quick response!

I am looking at it now. Is there a way to leave the center empty/transparent (as shown above), or even display a BMP in it? I do not want the inside pixels so close together. Thanks.

Re: Polar Series

Posted: Fri Jul 18, 2014 8:13 am
by narcis
Hi dpatch,

Casually, this is the same we discussed here a couple of days ago. PolarGrid series also has DrawZone method. However, it's also affected by ID850. Please feel free to sign up at bugzilla and add yourself to the CC List to receive bug update notifications.

Re: Polar Series

Posted: Fri Jul 18, 2014 9:13 am
by 16567885
If you're using a PolarGridSeries, can't you just not fill the inner cells? That would certainly make some Kind of a "hole" in there.

Also, placing something like a Bitmap in the centre of the polar diagram sounds appealing. Currently, I would not know how to best place some VCL component like a TPanel or TImage there so that it won't overlap with the diagram and only "fills" the hole.

Re: Polar Series

Posted: Fri Jul 18, 2014 9:26 am
by narcis
Hello Jens,

Thanks for your contribution.
jens.mertelmeyer wrote:If you're using a PolarGridSeries, can't you just not fill the inner cells? That would certainly make some Kind of a "hole" in there.
Yes, you are right. You could set those cells to null not to be painted, for example:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var Sector, Track : Integer;
    tmp     : TChartValue;
    index   : Integer;
begin
  with Series1 do
  begin
    Clear;

    CircleLabels:=True;
    RadiusIncrement:=1;

    NumSectors:=15;
    NumTracks:=10;

    BeginUpdate;

    for Sector:=0 to NumSectors-1 do
        for Track:=0 to NumTracks-1 do
        begin
          tmp:=0.5*Sqr(Cos(Sector/(NumSectors*0.2)))+
                   Sqr(Cos(Track/(NumTracks*0.2)))-
                   Cos(Track/(NumTracks*0.5));

          index:=AddCell(Sector,Track,tmp);

          if Track < 5 then
            SetNull(index);
        end;

    EndUpdate;

    AngleIncrement:=360/NumSectors;
  end;
end;
jens.mertelmeyer wrote:Also, placing something like a Bitmap in the centre of the polar diagram sounds appealing. Currently, I would not know how to best place some VCL component like a TPanel or TImage there so that it won't overlap with the diagram and only "fills" the hole.
It might be easier drawing an image in the chart canvas using its Draw or StretchDraw methods. The most difficult part would be calculating the exact image size and location.

Re: Polar Series

Posted: Fri Jul 18, 2014 2:32 pm
by 16568742
I don't seem to be able to find the TPolarGridSeries to drop it on the form. I see it in the User Guide but can't find it in TCharts. Can you help? Thanks!

Re: Polar Series

Posted: Fri Jul 18, 2014 2:37 pm
by narcis
Hi dpatch,

At design-time, using the chart editor (double-click on a TChart component) you can find it at Series > Add > 3D > Polar Grid, scrolling down if necessary. At run-time you can find it at the TeePolarGrid class.

Re: Polar Series

Posted: Fri Jul 18, 2014 7:12 pm
by 16568742
OK, I got this working. Is there a way to speed things up? Sort of like setting IrregularGrid in TColorGridSeries. Everything draws REALLY slow.

Re: Polar Series

Posted: Tue Jul 22, 2014 9:38 am
by 10050769
Hello dpatch,

Sorry for the delay. I think can be useful for you take a look in real time article where you can see different techniques to increase speed of your Chart.

Hoping it will help otherwise, don't hesitate to let me know.
Thanks in advance,

Re: Polar Series

Posted: Mon Aug 04, 2014 11:22 pm
by 16568742
Sandra,

I truely appreciate you reply. I have read the documents regarding how to speed up the plotting and honestly they are of little help. These are the same documents that you have referenced for years. If you put a lot of data into this type of plot you will quickly see my point. I think you can easily generate an image like the one I posted and tell me if you understand my issue. If not, I can supply you with a sample that will make my point.

Thanks in advance,
dave

Re: Polar Series

Posted: Wed Aug 06, 2014 7:46 am
by yeray
Hi Dave,

I've made a simple example and it seems to work fast for me here.

Code: Select all

uses TeePolarGrid;

procedure TForm1.FormCreate(Sender: TObject);
var index   : Integer;
begin
  Chart1.Align:=alClient;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TPolarGridSeries) do
  begin
    FillSampleValues(24);
    for index:=0 to Count-1 do
      if YValue[index] < 10 then
        ValueColor[index]:=clBlack;
  end;
end;
I've also tried incrementing the number of values (ie FillSampleValues(24) ending in 10.000 cells) and it still looks fast for me here.
FillSampleValues(24);