Need a special offer?Find out if your project fits.
+

How to remove the right click menù on bar and to color bar and sub bar

Answered
Fabrizio asked on September 11, 2023

Some tricks to remove the right click menù on bar and to color bar and sub bar?
Thanks

Nadia Khodakivska created this ticket from #57588

4 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 12, 2023

Hello Fabrizio,

Thank you for the question.

Please find our answers below:

Removing the right-click menu.
You can use the customizeContextMenu API call and its viewType property to disable the right-click menu:

function customizeContextMenuFunction(items, data, viewType) {
  if (viewType == "charts") {
    return [];
  }
}

customizeContextMenu can be defined in two ways:

  1. As a regular API call: flexmonster.customizeContextMenu(customizeFunction: Function).
  2. As an initialization parameter: new Flexmonster({customizeContextMenu: customizeFunction, ...}).

Changing chart colors.
The following example shows how to change the default colors for charts, check it out on JSFiddle.
To change the sub-bar colors, you can use the customizeChartElement method:

function customizeChartElementFunction(element, data) {
  let newColor = "#ff9999"
  if (data.rows && data.rows.length > 1) {
    element.style.fill = newColor;
  }
}

You are welcome to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/vxhsw1j2/. Feel free to customize this approach for your use case. 

Please let us know if our solution helped. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 21, 2023

Hello Fabrizio,

Hope you are doing well.

We were wondering if you had a chance to check the suggested approaches. Could you please confirm if they work for you?

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Fabrizio September 21, 2023

Yes, perfect! all ok!
I've write two new tickets.
Thanks

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 22, 2023

Hello,

Thank you for the feedback.

Our team is working on your questions. We will get back to you soon.

You are welcome to contact us in case other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer