Get Free Trial

How to get string values of xAxis from highcharts.getData

Answered
Oleg asked on February 4, 2021

I used this options but they didn’t help me. I have xAxis string values in Pivot but in raw data i’m getting number from string. Example: ‘My string 56′, raw data: ’56’

{type: 'line', valuesOnly: false, xAxisType: 'string'}

5 answers

Public
Milena Pechura Milena Pechura Flexmonster February 5, 2021

Hello, Oleg,
 
Thank you for posting to our forum.
 
Could you please clarify what are you trying to achieve or what issue you faced?
 
We have prepared the following example based on the info from your question: https://jsfiddle.net/flexmonster/deap4wmr/.
In the example, the Discount field values have a string type and are placed on the x-axis. There is also an options object specified in the highcharts.getData method. The rawData is logged to the console.
 
Would you be so kind to provide more details about your case or modify the example above?
This will greatly help us to investigate your question further.
 
Looking forward to your response.
 
Best regards,
Milena

Public
Oleg February 8, 2021

My xAxis values is just numbers. But in pivot it’s not just numbers. In your example everything is ok, but I don’t know why it’s happening on my side.
 
code:

const drawChart = (rawData: any) => {
//here in rawData I have YAxis fields without text. only numbers.
if (rawData.series.length) {
dispatch(setChartData(optimizeChartData(rawData)));
}
};
dispatch(getDashboardSuccess(JSON.parse(dashboard.data)));
flexmonsterRef.current?.flexmonster.setReport(formattedReport);
flexmonsterRef.current?.flexmonster.highcharts?.getData({type: 'bar'}, drawChart, drawChart);
Public
Milena Pechura Milena Pechura Flexmonster February 9, 2021

Hi, Oleg,
 
Thank you for providing the code snippet and the screenshot.
 
In your code, we have not noticed anything that could cause the issue.
 
However, our team came up with some ideas that may help. Please see our suggestions below:

  1. To make sure that every field has an expected type in the pivot table, define types in the mapping object of your report.
  2. If the mapping is already defined, please check whether the type for the Campaign field is "string".
  3. We also recommend reviewing your data. Perhaps there are some data errors.

Please let us know if our response helped and if any other questions arose.
Looking forward to hearing from you.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster February 22, 2021

Hello, Oleg,
 
Hope you are doing well.
 
We were wondering whether our suggestions helped to solve the issue.
Please let us know if everything works fine now.
 
Waiting for your answer.
 
Kind regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster March 3, 2021

Hi, Oleg,
 
How are you?
 
We are just checking in to ask if our suggestions helped.
Could you please let us know whether the issue is solved?
 
Our team will be glad to hear your feedback.
Looking forward to your response.
 
Best regards,
Milena

Please login or Register to Submit Answer