Skip to content

add a link as low level parameter in the chart component #1244

@SebastiendOrnano

Description

@SebastiendOrnano

In some case you want to change quickly data in a chart. For example, I have a timeline :

Image

and I want to change the starting date or ending date of workpackage. With the standard component, I must add a datagrid-item in the dashboard or put a button somewhere to open a form to edit the workpackage.

In most of project management apps, you just have to click on the range bar to open the edition form.

Describe the solution you'd like

I committed a small custumization in the handlebar by adding {{~#if link}}, {{~ stringify link ~}} {{~/if~}}in

  "points":
     [
      {{~#each_row~}}
        {{~#if (gt @row_index 0)}},{{/if~}}
        [
            {{~ stringify (default series (default ../title "")) ~}},
            {{~ stringify (default x label) ~}},
            {{~ stringify (default y value) ~}}
            {{~#if z}}, {{~ stringify z ~}} {{~/if~}}
            {{~#if link}}, {{~ stringify link ~}} {{~/if~}}
        ]
    {{~/each_row~}}

So the chart is responding as in the map component where you have just to click on point to open a link. :

SELECT 
    w.workpackage_name                       AS series,
    w.workpackage_id                         AS _sqlpage_id,
    w.workpackage_name  ||'    Planififié'    AS label,
   '/e_project_workpackage/workpackage_date_edit_4.sql?workpackage_id='||w.workpackage_id as link,
    w.workpackage_date_start_scheduled        AS value,
    w.workpackage_date_end_scheduled          AS value
  FROM project_workpackage AS w
  left join (SELECT project_id FROM project) AS p
  on w.project_id=p.project_id
  WHERE p.project_id=$project_id::INTEGER
  ORDER BY w.workpackage_date_start_scheduled ASC;

There is a small point where to open the link since if you change data of the timeline, the page should be refresh to show the change. The best would be to open the form in the same tab with a validation button which send the user back to the chart (in my case, I add a javascript to open the form in a modal mode with resfresh function when closing the modal - but il is a bit over compicated)

Perhaps this addition could be introduce in the standard component as it gives users more options when using chart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions