Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jqplot] allow more / flexible options vs. switching to other charting library #633

Open
gesinn-it-gea opened this issue Jan 20, 2021 · 5 comments

Comments

@gesinn-it-gea
Copy link
Member

gesinn-it-gea commented Jan 20, 2021

Currently, jqplot SRF does provide a subset of options available in the jqplot lib, see https://www.semantic-mediawiki.org/wiki/Help:Jqplotchart_format and http://www.jqplot.com/docs/files/optionsTutorial-txt.html

For example, the Grid allows http://www.jqplot.com/docs/files/jqplot-core-js.html#Grid

  • drawGridlines | whether to draw the gridlines on the plot.
  • gridLineColor | color of the grid lines.
  • gridLineWidth | width of the grid lines.
  • background | css spec for the background color.
  • borderColor | css spec for the color of the grid border.
  • borderWidth | width of the border in pixels.
  • drawBorder | True to draw border around grid.
  • shadow | whether to show a shadow behind the grid.
  • shadowAngle | shadow angle in degrees
  • shadowOffset | Offset of each shadow stroke from the border in pixels
  • shadowWidth | width of the stoke for the shadow
  • shadowDepth | Number of times shadow is stroked, each stroke offset shadowOffset from the last.
  • shadowColor | an optional css color spec for the shadow in ‘rgba(n, n, n, n)’ form
  • shadowAlpha | Alpha channel transparency of shadow.

Styling the jqplot SRF is limited at the moment, because it renders a canvas based on options provided. This does only allow limited styling via CSS. For example it is not trivial, to change the canvas border's width.

I suggest to replace the approach to use a theme (which can not be easily modified on a per query basis) to allow more flexible options.

'grid' => $this->params['theme'] === 'vector' ? [ 'borderColor' => '#a7d7f9' ] : ( $this->params['theme'] === 'simple' ? [ 'borderColor' => '#ddd' ] : null ),

to be replaced with something like

'grid' => [
  $this->params['gridBorderColor'],
  $this->params['gridBorderWidth']
],

This could be used for all options provided by the differen jqplot classes, like Grid, Axis, Legend and so on.

@JeroenDeDauw @kghbln @krabina what do you think?

@gesinn-it-gea
Copy link
Member Author

P.S. any change should not break existing settings

@krabina
Copy link
Contributor

krabina commented Jan 20, 2021

Great idea! Updates to SRF are always very welcome.

@gesinn-it-gea
Copy link
Member Author

message to self: looking at this issue today, I'm not sure if it's worth maintaining JqPlot which seems to be inactive since 2018. We should consider alternative charting/visualization libs like https://github.com/apache/echarts or enhancing D3 format.

@krabina
Copy link
Contributor

krabina commented Jan 30, 2023

I am in favor of switching so something that is maintained. 5 year old code might also involve secuirty issues. D3 is not an alternative hiere, since SRF already is supporting it (and probably could do better), it is also very complex compared to jqplot.

I don't know echarts. It's looking good. Also found this: https://github.com/chartjs/Chart.js

I think we should think about branching SRF to version 5 at some point, where we also discontiue other obsolete formats such as exhibit, But this should be handled in a different ticket.

Also to consider: there are at least 7 other issues qith jqplot, so starting a clean written result format based on a new, maintained library might also be a better idea reagarding effort.

@krabina
Copy link
Contributor

krabina commented Jul 29, 2023

Based on this article https://medium.com/bazaar-tech/best-js-charting-libraries-99e3edfddc64 it seems that Charts.js could be the better option to replace jqplot, because it is simpler. We have D3.js support, so we have the complex end covered as well.

@krabina krabina changed the title [jqplot] allow more / flexible use of jqplot options [jqplot] allow more / flexible options vs. switching to other charting library Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants