jahlxx Posted January 20, 2020 Share Posted January 20, 2020 Hi. How can I change the serie title of a chart in run time? Tested on bar series, but don't work. The title doesn't change, is allways the title defined at design time. Thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 20, 2020 Share Posted January 20, 2020 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? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 20, 2020 Author Share Posted January 20, 2020 build 1454 my code is simple: series3.title := 'my title'; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 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'); Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 21, 2020 Author Share Posted January 21, 2020 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) 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 31 minutes ago, jahlxx said: And what about this kind of labels? (see image) They are already implemented. UniChart -> Axes -> AxisA -> Title, AxisB -> Title UniChart -> Title -> Text Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 21, 2020 Author Share Posted January 21, 2020 Ok. Title is shown. Not like in Chart.js, but is OK for me. AxisA is shown, but unformatted: AxisB, is not shown. My code is: UniChart3.Axes.AxisA.Title := 'Test Vertical'; UniChart3.Axes.AxisB.Title := 'Test Horizontal'; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 1 minute ago, jahlxx said: AxisB, is not shown. Can you make a testcase for reproduce!? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 21, 2020 Author Share Posted January 21, 2020 Ok Works. The problem is calling to SetTitle procedure. When call, the behaviour is as explained before. If don't call to that procedure, AxisA and AxisB are shown. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 11 minutes ago, jahlxx said: The problem is calling to SetTitle procedure. When call, the behaviour is as explained before. If don't call to that procedure, AxisA and AxisB are shown. Really? I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 25 minutes ago, jahlxx said: The problem is calling to SetTitle procedure. When call, the behaviour is as explained before. If don't call to that procedure, AxisA and AxisB are shown. I couldn't reproduce this behavior. Works for me. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 21, 2020 Author Share Posted January 21, 2020 please, see attached. test.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 8 minutes ago, jahlxx said: please, see attached. test.zip .. with AUniBarSeries.Parent.JSInterface do //JSCall('chart.series[0].setTitle', [JSArray(Titles)]); JSCode('try {'#1'.chart.series[0].setTitle(['+ Titles +'])} catch(err){};'); ... Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 21, 2020 Author Share Posted January 21, 2020 Ok, Thanks. So complicated for a simple task. Should be: series3.title := 'my title'; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 21, 2020 Share Posted January 21, 2020 1 hour ago, jahlxx said: So complicated for a simple task. Should be: series3.title := 'my title'; I do not argue with you, just gave a temporary solution. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted January 21, 2020 Author Share Posted January 21, 2020 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 22, 2020 Share Posted January 22, 2020 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.