Jump to content

Woutero

uniGUI Subscriber
  • Posts

    107
  • Joined

  • Last visited

Everything posted by Woutero

  1. Thanks. Can you please give an example, so that I can see the correct syntax?
  2. Sherzod I need to change/increase the Bar width of bars in the series, at runtime. In another thread you provided a solution to set the MaxBarWidth via the beforeInit event: function chart.beforeInit(sender, config) { config.series[0].marker = false; config.series[0].renderer = function(a) { a.attr.maxBarWidth=10; }; But how can I set the BarWidth via a JSInterface.JSCall? Similar to UniChart1.JSInterface.JSCall('chart.series[0].setStacked', [False]);
  3. Sherzod C++: bool tbool=False; UniChart1->JSInterface->JSCall("chart.series[0].setStacked", ((tbool))); works, thanks so much!
  4. Sherzod No unfortunately it does not work. Even when I use UniBarSeries1->Stacked = true; UniBarSeries2->Stacked = true; UniBarSeries3->Stacked = true; it does not work. Only the original Stacked setting as per the UniBarSeries on the UniChart at design time is used. If I change the Stacked property at runtime, the UniChart does not use the new setting. Remember, I also cannot create Series dynamically in C++, I can only create Series upfront on the UniChart via design. Is there any way how one can set the Stacked setting during run time via JavaScript?
  5. As in JSInterface.JSCall('chart.redraw', []); Or within a Event?
  6. Sherzod I was able to set the Stacked property for the underlying UniBarSeries using the following C++ procedure: void __fastcall TForm1::SetStacked(TUniChartSeries *AUniSeries, bool IsStacked) { int I; for (I=0; I<AUniSeries->Parent->SeriesList->Count; I++) { TUniBarSeries *BarSeries = new TUniBarSeries(AUniSeries->Parent); BarSeries = (TUniBarSeries *) AUniSeries->Parent->SeriesList->Series[I]; BarSeries->Stacked = IsStacked; } } But, the actual charts are not updated. So we are sitting with a similar problem as with Titles. I assume we will have to use an afterrender event to update the Stacked property of the UniBarSeries on the Chart? But how?
  7. Sherzod Your solution for the Titles is working like a charm, thanks. But how can I set the Stacked property of a UniBarSeries via the SeriesList? In other words if Series[0], Series[1] and Series[2] are all UniBarSeries, I want to do: UniChart1->SeriesList->Series[0]->Stacked = false; UniChart1->SeriesList->Series[1]->Stacked = false; UniChart1->SeriesList->Series[2]->Stacked = false;
  8. Sherzod Good news, success! I had some time to double check everything. There was a } character missing in the afterrender event, causing the freeze. Finally I was able to display 3 new titles for a UniBarSeries using the C++ code UnicodeString TestStr1, TestStr2, TestStr3; TestStr1 = "Test1"; TestStr2 = "Test2"; TestStr3 = "Test3"; UniChart3->JSInterface->JSCall("_setTitle", ARRAYOFCONST((TestStr1,TestStr2,TestStr3))); No need for using SetTitle(). Thank so much, you're a genius!
  9. Uncaught SyntaxError: Unexpected token ')'
  10. Sherzod When I use this code, it just hangs at startup of http://localhost:8077/ Do we use the ExtEvents script as is?
  11. Sherzod Thanks, I will try the method above and report back. I was able to make some progress on the C++ code. The following C++ code for SetTitle compile under C++ Builder 10.4. void __fastcall TMainForm::SetTitle(TUniBarSeries *AUniSeries, UnicodeString ATitle) { int I; UnicodeString Titles = ""; if ((ATitle != "") && (AUniSeries->Title != ATitle)) { AUniSeries->Title = ATitle; for (I=0; I<AUniSeries->Parent->SeriesList->Count; I++) { TUniBarSeries *BarSeries = new TUniBarSeries(AUniSeries->Parent); BarSeries = (TUniBarSeries *) AUniSeries->Parent->SeriesList->Series[I]; Titles = Titles + "\"" + BarSeries->Title + "\","; } Titles = RemoveTrailingChar(Titles, ','); // Up until here Titles agree with running in Delphi, yet series Titles are not updated on chart when the next line is executed AUniSeries->Parent->JSInterface->JSCall((UnicodeString)L"chart.series[0].setTitle",ARRAYOFCONST((Titles))); } } In debug mode, it generates exactly the same output in Titles when compared to running in Delphi. Yet, the labels are not updated on the chart. So we now only have one line of Delphi code that we need to get a working C++ translation. DELPHI: with AUniBarSeries.Parent.JSInterface do JSCall('chart.series[0].setTitle', [JSArray(Titles)]); C++: AUniSeries->Parent->JSInterface->JSCall((UnicodeString)L"chart.series[0].setTitle",ARRAYOFCONST((Titles)));
  12. On my side I was using 3 x UniLineSeries and 3 x UniBarSeries, so its strange that it worked with UniLineSeries. Thanks for trying to add support for UniChart->SeriesList->Series[0]->Title = "New Title"; Much appreciated! It's a pity though that we can't get SetTitle() to work for C++ as an interim solution. Not being able to change the title for a series is a showstopper for me right now.
  13. Sherzod I believe it should work. The following C++ code works perfectly for UniLineSeries, but does not work for UniBarSeries, UniAreaSeries and other series: UnicodeString NewTitle; NewTitle = "New Title"; if (StreamNo==0) ThisChart->JSInterface->JSCall((UnicodeString)L"chart.series[0].setTitle",ARRAYOFCONST((NewTitle))); if (StreamNo==1) ThisChart->JSInterface->JSCall((UnicodeString)L"chart.series[1].setTitle",ARRAYOFCONST((NewTitle))); if (StreamNo==2) ThisChart->JSInterface->JSCall((UnicodeString)L"chart.series[2].setTitle",ARRAYOFCONST((NewTitle))); When the same code is run on UniBarSeries and UniAreaSeries then it generates an Ajax error: Cannot read properties of undefined (reading 'setTitle') Why can't UniGUI simply allow: UniChart->SeriesList->Series[0]->Title = "New Title"; UniChart->SeriesList->Series[1]->Title = "New Title"; UniChart->SeriesList->Series[2]->Title = "New Title";
  14. Though the following is allowed: Title1 = UniBarSeries1->Title; Title2 = UniBarSeries2->Title; Title3 = UniBarSeries3->Title;
  15. Did you mean: Title1 = UniChart->SeriesList->Series[0]->Title; Title2 = UniChart->SeriesList->Series[1]->Title; Title3 = UniChart->SeriesList->Series[2]->Title; This is not allowed, gives error: 'Title' is a protected member of 'UniChart::TUniChartSeries'
  16. Sherzod, I don't understand your question?
  17. Anyone else with suggestions? We need to translate the following line of Delphi code to C++: for I := 0 to AUniBarSeries.Parent.SeriesList.Count-1 do Titles := Titles + '"' + (AUniBarSeries.Parent.SeriesList[I] as TUniBarSeries).Title + '",'; Currently we have for (I = 0; I < AUniSeries->Parent->SeriesList->Count; ++I) { TUniBarSeries *Series = AUniSeries->Parent->SeriesList->Items[I]; TUniBarSeries *BarSeries = (TUniBarSeries*)Series; // Explicit casting, Make sure all types are the same... Titles = Titles + "\"" + BarSeries->Title + "\","; } which throws na error: cannot initialize a variable of type 'Unichart::TUniBarSeries *' with an rvalue of type 'void *'
  18. Sorry, still not compiling. TUniBarSeries *Series = AUniSeries->Parent->SeriesList->Items[I]; throws error: cannot initialize a variable of type 'Unichart::TUniBarSeries *' with an rvalue of type 'void *' AUniSeries->Parent->JSInterface->JSCall("chart.series[0].setTitle", AUniSeries->Parent->JSInterface->JSArray(Titles)); throws error: no matching member function for call to 'JSCall'
  19. Sherzod Thanks! Which units should I include to compile? C++ Builder 10.4 (target Windows 64bit) throws error at dynamic_cast: 'void' is not a class Also does not recognize TJSArray when I include "System.JSON.hpp"
  20. Sherzod Yes, the SetTitle() procedure works in Delphi, but I cannot get the SetTitle procedure to work in C++. This is the code that I have used: #pragma link "uniStrUtils" void __fastcall TMainForm::SetTitle(TUniBarSeries *AUniBarSeries, UnicodeString ATitle) { int I; UnicodeString Titles; Titles = ""; if ((ATitle!="") && (AUniBarSeries->Title!=ATitle)) { AUniBarSeries->Title = ATitle; for (I=0; I<AUniBarSeries->Parent->SeriesList->Count; I++) Titles = Titles + """ + ((TUniBarSeries)AUniBarSeries->Parent->SeriesList[I])->Title + "","; Titles = RemoveTrailingChar(Titles, ','); AUniBarSeries->Parent->JSInterface->JSCall("chart.series[0].setTitle",ARRAYOFCONST((Titles))); } } By the way, I have added the line Titles = "" because Titles was never initialized before the loop. I tried both String and UnicodeString. How should we change SetTitle() to work in C++?
  21. I inserted 3 x UniBarSeries on a UniChart. So its UniBarSeries1, UniBarSeries2, UniBarSeries3
  22. Sherzod I tested in Delphi 10.4.2 ThisChart.JSInterface.JSCall('chart.series[0].setTitle',[NewTitle]); gives runtime error: Cannot read properties of undefined (reading 'setTitle') ThisChart.JSInterface.JSCall('chart.getSeries()[0].setTitle',[NewTitle]); gives same error. ThisChart.JSInterface.JSCall('chart.series.getAt(0).setTitle',[NewTitle]); gives runtime error: chart.series.getAt is not a function Delphi also does not allow UniChart1.SeriesList.Series[0].Title := 'New Title'; giving compiling error: Cannot access protected symbol TUniChartSeries
  23. Sherzod I also tried "chart.getSeries()[0].setTitle"... which gave the error: Cannot read properties of undefined (reading 'setTitle') and "chart.series.getAt(0).setTitle"... gave the error: chart.series.getAt is not a function
  24. Sir I'm using UniGUI Complete Professional V1.90.0.1560 in RAD C++ Builder 10.4 Update 2. I'm getting an Ajax error when trying to assign a new title to a stream of a UniChart. I have the following procedure: void __fastcall TMainForm::SetNewTitle(TUniChart *ThisChart, int StreamNo) { UnicodeString NewTitle; NewTitle = "New Title"; if (StreamNo==0) ThisChart->JSInterface->JSCall((UnicodeString)L"chart.series[0].setTitle",ARRAYOFCONST((NewTitle))); if (StreamNo==1) ThisChart->JSInterface->JSCall((UnicodeString)L"chart.series[1].setTitle",ARRAYOFCONST((NewTitle))); if (StreamNo==2) ThisChart->JSInterface->JSCall((UnicodeString)L"chart.series[2].setTitle",ARRAYOFCONST((NewTitle))); } As long as the UniChart has 3 UniLineSeries, everything works fine when I call SetNewTitle(UniChart,0); SetNewTitle(UniChart,1); SetNewTitle(UniChart,2); But as soon as I use 3 UniBarSeries, UniAreaSeries or any other series on the UniChart, then calling SetNewTitle for all 3 series gives an Ajax error: "Cannot read properties of undefined (reading 'SetTitle')" The easiest fix would be to allow us to set the Title property for each Series in the SeriesList: UniChart->SeriesList->Series[0]->Title = "New Title"; UniChart->SeriesList->Series[1]->Title = "New Title"; UniChart->SeriesList->Series[2]->Title = "New Title"; Then we don't even have to use the JSCall which is not working for UniBarSeries, UniAreaSeries and other series in C++Builder. By the way, I have to tell you that the uniGUI framework is most amazing. I only have the greatest respect for your work, you are a genius!! If only we could fix this bug then I will be a vey happy customer…
×
×
  • Create New...