Create a trendline in chart with 4D View Pro


First of all, I understand that 4D View Pro is based on SpreadJS so some of the requested features are out of 4D’s control

I am investigating the possibilities of the charts in 4D View Pro, and what would be needed to to use them
1 of my requirements is to create a trendline (see picture). In excel there is a standard option to create a trendline, but combining 2 type of charts would also be an option.
Is this possible in 4D View Pro?


Sorry, i did never test 4DViewPro (based on SpreadJS,
but spreadJS offers all this wished features and more solutions.
Which plugins behind this i did not know…

See features here:

Or only one of many online-tests live here:

I did not know when all of this possibilies (and more from other pages) arrived in 4DViewPro
or if it is available now. 4DViewPro gets in the next moths/years a lot of amazing new stuff, but this can not be done in one day :wink:

Try the online-test, there are so many option to define a chart…different kinds of trendlines too…

1 Like

Hi Lutz,

thanks for your reply
For some reason I thought it was not possible to create trendlines, but to my surprise they DO work, also in 4D View Pro!
I am investigating the possibility to create nice dynamic reports with charts based on View Pro

Thanks again,

What documentation links are you using to graph in 4D View Pro?

Hi Jeremy,

Sorry for the confusion, but I don’t create the graphs by programming

I am investigating the possibilities so it is a proof of concept.

  1. I create a worksheet in Excel, with data and the chart
  2. I import this sheet in 4D View Pro
  3. I fill the cells by programming with data from the database

So, In fact I use an excel worksheet as a template and fill the data by programming

As Lutz noted, SpreadJS provides graphing.

Tai Bui showed graphing in his 2020 4D Virtual Summit presentation: 4D View Pro

You can view the Tai’s graphing presentation at time 35:25.

I would like to know what link we use to see the documentation for graphing.

The Ribbon interface can set 4D-form-object-properties
or with Javascript any available theme/toolbar in spreadJS.

  • On INSERT Tab you can insert a chart or a sparkline
  • On DESIGN Tab when a chart-object is selected, you have a lot of options to custom your charts
  • DoubleClick or ContextClick on Chart or on a Element in the chart shows you design-options at right menu.

For coding, spreadJS API is available in 4DViewPro thruw “WA Evaluate JavaScript” (example from 4Ddemo):

jsScript_t:="spread.getActiveSheet().charts.add('Chart1',  GC.Spread.Sheets.Charts.ChartType."+chartType_at{chartType_at}+", 20, 300, 400, 300, \"A1:E13\");"
WA Evaluate JavaScript(*;"ViewProArea";jsScript_t;Is longint)




or try self search and explore docu:

1 Like

Thanks for the documentation links, Lutz.

Is 4D user version SpreadJS version 13?

Yes i think so, it is 13.0.6 (hope this is correct;-)…look into components folder of 4D…

Hi Lutz,

Windows 10, 4D v18R2
When I create a chart in 4D View Pro and want to format the chart (title) by using the contextual menu option “Format Chart Title” or “Format Chart Area” nothing happens, there doesn’t popup a window. Other options DO.

Can you confirm this issue?

Hi Piotr

Sorry, i am to lazy to activate any secondary windows system and a 4DR2.
My main system is only mac ( and win alternativ i start only when i must :wink:

I think this works in any v18 on Windows and on Mac.

Very important, the window and the ViewProArea must big enough
to correct show inside all spreadJS Dialogs without cutting it
and without losing it in offscreen.
The dialog for Title is shown own the right side (when enough space innner viewProArea).
Yes it happens too me much times where no dialog can see in right-panel,
but this spreadJS Behavior can easy go around by new select chart …play a little bit…
this one can easy done.
When you know this and understand to manage this UI, than all can used very easy,
like in other apps needs always little bit time to learn how to deal with the thing so that everything runs smoothly.
You can too (instead to context-menu or topbar) doubleclick on the item inside the chart,
this work perfect (same right pane) with all objects inside chart like titles, names, lines…


Strange, but it really does not work in my 4D View Pro on Windows
I have a sheet that is width enough to show column AB
I fill column A with some date and create a chart
Whatever I try, double clicking for example, nothing happens, no panel on the right side
Hint: I also don’t selection rectangle around Title when double clicking it

The main trick is “new select chart”

  • first click in any empty cell to unselect the chart (no points on the edges after)
  • than click again on the chart (points now shown again …ok is fresh selected)
  • than right-click inside the chart open context menu choose formatChartTitle
  • now on right side a option-panel for “title” appears.

Or easier explained,
you must stay on last tab “DESIGN” (and maybe in addition fresh re-selected chart)
(this tab is choosen automatically when you new-re-select unselected chart)
Only when this tab is active you can open the right option-pane!

Important too,
you must see the right scrollbar of your sheet,
otherwise you not see right-pane it is in offscreen than.
Your full sheet inclusive rollbar must shown in area,
because the right-pane is on the last opened right position.

I am quite sure that it works.
After it you say for sure, ohhh that is easy to do, but must known before.
To explain it is little bit difficult in words, this can better shown live.

I have done everythin you advise

  • first click in any empty cell to unselect the chart (no points on the edges after)
  • than click again on the chart (points now shown again …ok is fresh selected)
  • than right-click inside the chart open context menu choose formatChartTitle
  • I see the right scrollbar
  • I am on the DESIGN tab
  • my full sheet inclusive scrollbar is shown in area

but… No format panel

I can reproduce your problem when i start my R3-Project-TestDB
with 4Dv18R2 on MacOSX.

Now i must look why, beginning build a fresh R2 DB and Debug the webarea inside
with new command “WA OPEN WEB INSPECTOR” (ohh no this is new command in R3 not exist in R2).

Use maybe instead the R3 (not R2)

Or can have a live online-tests here (only to see how it works):

Difference between R2 and R3 is naturally the 4D part
and spreadJS VersionBuild differs only a little bit:

  • 4DR2 (spreadJS 13.0.0)
  • 4DR3 (spreadJS 13.0.6)

(( i mean the scrollbar of the sheet, not for webarea and not from 4Dwindow ))
(( but the problem is in R2, there i can too never see the option panel ))

So as I understand correctly, you have the same problem with 4D v18R2?

Yes you correct, that is what is sayed.

R2 i do not use.
For RealProductivitiy we are on v18.0build249095
For testing future i use only i use only v18R3Beta.
(i do not use R2)
(i do not use 4DViewPro in RealProductivitiy, just begin with next Version with ViewPro)

To verify now why you had this behavior i uses any old v18R2build248972
what i found on may localdisk.

Until our RealProductivitiy becomes new use-cases with new ViewPro(64bit)
R3 is than out of Beta-Status and we have no problems with right-pane than in a R3.

spreadJS spreadJS 13.0. 0 (used in R2)
is not yet fully developed in all corners (like spreadJS 13.0. 6).

When you want complete feature list of spreadJS then use minimum spreadJS 13.0. 6.
So wait until you go to R3
or switch now from your R2 to R3 for developing
and if you are going to release a new product version soon,
then R3 will be out of beta status.

1 Like

I test again another hack.

First before test,
i save orginal R2 component 4D ViewPro.4dbase
outside on my Desktop.

Then i try only for testing,
make copy from
/Applications/4D v18 R3Build251856/ ViewPro.4dbase
and paste the copy into
/Applications/4D v18 R2/
(( replace exist R2-viewpro-component with a copy of R3-viewpro-component ))

Now i see, all works in R2
too the right pane
and too you got than spreadJS 13.0.6 into R2.
All looks fine to me, without any garanty.

This info is only for testing,
i see no problems,
but you must clarified this with 4D
and too with the betaLicenceAgreements…

1 Like

SpreadJS has many updates, that both fix problems and add functionalities, even in minor versions, so we try to always release the new versions of 4D with the latest versions of spreadJS so you can have the best experience.
Even if it seems to work, using a 4D View Pro R3 component in a 4D R2 will certainly gives you some (bad) surprises at some point, the R3 component may rely on improvements made in 4D code that will certainly broke something somewhere.

1 Like