Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chart.js + Template
#2
(11-06-2020, 12:13 PM)matija Wrote: Something from code:
Code:
datasets: [{
            label: '# Years',
            data: [2020, 2019, 2018],


The easiest way is to use TIWTemplateProcessorHTML with OnUnknownTag event.
In your template you replace "data: [2020, 2019, 2018]" with {$_MYDATA_$} for example and then in TIWTemplateProcessorHTML.OnUnknownTag event you do something like:


Code:
procedure TYourForm.IWTemplateProcessorHTML1UnknownTag(const AName: string; var VValue: string);
begin
  if SameText(AName, '_MYDATA_') then
  begin
    VValue := 'data: [2020, 2019, 2018]'; //<-- you get the values from your db here
  end;
end;

Another way would be to use Custom Content Handlers.
Reply


Messages In This Thread
Chart.js + Template - by matija - 11-06-2020, 12:13 PM
RE: Chart.js + Template - by ioan - 11-06-2020, 05:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)