Jump to content

unichart series title


jahlxx

Recommended Posts

2 minutes ago, jahlxx said:

How can I change the serie title of a chart in run time?

Hello,

Which build are you using?

2 minutes ago, jahlxx said:

 Tested on bar series, but don't work. The title doesn't change, is allways the title defined at design time.

Can you give the code you use?

Link to comment
Share on other sites

18 hours ago, jahlxx said:

Tested on bar series

Can you try this approach for now?

1. 

uses ... uniStrUtils;

2. procedure SetTitle(AUniBarSeries: TUniBarSeries; ATitle: string);

procedure TMainForm.SetTitle(AUniBarSeries: TUniBarSeries; ATitle: string);
var
  I: Integer;
  Titles: string;
begin
  if (ATitle<>'')and(AUniBarSeries.Title<>ATitle) then
  begin
    AUniBarSeries.Title := ATitle;
    for I := 0 to AUniBarSeries.Parent.SeriesList.Count-1 do
      Titles := Titles + '"' + (AUniBarSeries.Parent.SeriesList[I] as TUniBarSeries).Title + '",';

    Titles := RemoveTrailingChar(Titles, ',');
    with AUniBarSeries.Parent.JSInterface do
      JSCall('chart.series[0].setTitle', [JSArray(Titles)]);
  end;

end;

3. Use

SetTitle(Series3, 'newTitle');

 

Link to comment
Share on other sites

Ok. It works, Thanks. I think that is a extrange for an easy task, but works.

And what about this kind of labels? (see image)

image.thumb.png.491f98f961dc034da88960dffc06a0c1.png

 

This is done with Chart.js. Is possible with unichart? I prefer don't use external utils is I can do them with standard components.

Thanks.

 

 

Link to comment
Share on other sites

Ok.

Title is shown. Not like in Chart.js, but is OK for me.

AxisA is shown, but unformatted:

image.png.fbe821bf711b2270df2a422d0ab777a8.png

 

AxisB, is not shown.

 

My code is:

   UniChart3.Axes.AxisA.Title := 'Test Vertical';
   UniChart3.Axes.AxisB.Title := 'Test Horizontal';

 

 

Link to comment
Share on other sites

Sorry!!

Maybe you didn't understand me or I did't explain ok.

Thanks for your temporary solution. I meant that the solution should be as simple as assign text to the property of the element. That's all. Perhaps is a bug og UniGUI that will be corrected in later builds.

Sorry again friend.

 

 

Link to comment
Share on other sites

10 hours ago, jahlxx said:

Sorry!!

Maybe you didn't understand me or I did't explain ok.

Thanks for your temporary solution. I meant that the solution should be as simple as assign text to the property of the element. That's all. Perhaps is a bug og UniGUI that will be corrected in later builds.

Sorry again friend.

No, really everything is OK!

Sorry, you're right, we need to do this using the property. I will open a ticket in the support portal.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...