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

How to fix the issue for decimal value columns not being able to render Pie chart ?

Answered
Darshan Nath asked on April 12, 2024

In our application we have set up our database in AWS Redshift where we are storing data to show in our Flex monster report.

Few columns (for example : variance_minutes integer ENCODE az64) are working fine, but while trying to show pie charts for data with decimal values(for example : variance_hours numeric(5, 2) ENCODE az64) is not loading).In flat form these decimal values are displayed. When I change the datatype for the above to integer, it's able to render the pie chart. But it's not a viable option for us as it's does not go well with the product requirements. Also, while working with the Flex monster online sandbox after connecting our data as local CSV, it's able to render the chart.

So can you let me know what might be causing this issue or any configuration changes needed to be done from the application side.

6 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 15, 2024

Hello,

Thank you for reaching out to us.

We suppose that Flexmonster parses the data with decimal values as string values. We recommend explicitly setting the field type to "number" using the Mapping. Please check the following guide for reference: https://www.flexmonster.com/doc/mapping/
To set the Mapping, you can use the following code:

report: {
dataSource: {
// other configs
mapping: {
"variance_hours": {
type: "number",
},
}
},
// other configs
}

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Darshan Nath April 15, 2024

Hi Nadia,

Thanks for such quick response.

I tried this solution suggested by you, but still not able to see pie chart for the following column with decimal value.(eg : sum of variance hours)

Please let us know if there's any other solution for this problem.

 

Thanks,

Darshan

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 16, 2024

Hi Darshan,

Thank you for the response.

Could you please provide us with the report file where the issue is reproducible? You can get it by clicking the Save tab on the Toolbar. It saves the report with the current configuration to the local file system. Also, do you use Flexmonster Data Server to connect to the database? It would greatly help us to continue the investigation.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Darshan Nath April 17, 2024

Hi Nadia,
Here's the report file you asked for. I have also attached a screenshot of where the defect is producible.
Also, we don't use Flex monster data server, we use our own server.
 
Regards,
Darshan

Public
Darshan Nath April 18, 2024

Hi,
I have attached the file in the previous comment, But i am not able to see it, hence pasting the same report file as itself,
 
{
"dataSource": {
"type": "api",
"url": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx.xxxxxxxxxxxxxxxxxx", //our_staging_ENV_url
"index": "attendance"
},
"slice": {
"rows": [
{
"uniqueName": "name",
"caption": "Name"
},
{
"uniqueName": "birthday",
"caption": "Birthday"
},
{
"uniqueName": "group_name",
"caption": "Group"
},
{
"uniqueName": "org_name",
"caption": "Org(s)"
},
{
"uniqueName": "checkin_date",
"caption": "Check In"
},
{
"uniqueName": "checkout_date",
"caption": "Check Out"
},
{
"uniqueName": "checkin_by",
"caption": "Checked In By"
},
{
"uniqueName": "checkout_by",
"caption": "Checked Out By"
},
{
"uniqueName": "schedule",
"caption": "Schedule"
},
{
"uniqueName": "absent_reason",
"caption": "Absent Reason"
},
{
"uniqueName": "cancellation_comment",
"caption": "Cancellation (Comments)"
},
{
"uniqueName": "cancellation_date",
"caption": "Cancellation Date"
},
{
"uniqueName": "type",
"caption": "Type"
}
],
"columns": [
{
"uniqueName": "[Measures]"
}
],
"measures": [
{
"uniqueName": "elapsed_time",
"aggregation": "sum",
"caption": "Elapsed Time"
},
{
"uniqueName": "variance_minutes",
"aggregation": "sum",
"caption": "Variance (mins)"
},
{
"uniqueName": "variance_hours",
"aggregation": "sum",
"caption": "Hours"
}
],
"flatOrder": [
"name",
"birthday",
"group_name",
"org_name",
"checkin_date",
"checkout_date",
"checkin_by",
"checkout_by",
"elapsed_time",
"schedule",
"variance_minutes",
"variance_hours",
"absent_reason",
"cancellation_comment",
"cancellation_date",
"type"
]
},
"options": {
"viewType": "charts",
"grid": {
"type": "flat",
"showGrandTotals": "off"
},
"chart": {
"type": "pie",
"activeMeasure": {
"uniqueName": "variance_hours",
"aggregation": "sum"
}
}
},
"version": "2.9.75",
"creationDate": "2024-04-17T08:25:28.734Z"
}
 
 

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 18, 2024

Hello Darshan,

Thank you for sharing your report.

If you are using the custom data source API, we recommend checking if there are number values in the AggregatedDataObject - the object that is used in the responses to the /select requests for the pivot table and the flat table. Flexmonster supports values in the following format (with . as a decimal separator):

{
"fields": [
{ "uniqueName": "Country" },
{ "uniqueName": "variance_hours" }
],
"hits": [
["Germany", 12.25],
["Germany", 4.5],
["Germany", 6.95]
],
"aggs": [
{
"values": {
"Price": {
"sum": 23.7
}
}
}
],
"page": 0,
"pageTotal": 1
}

Kindly check if your server responds with the correct data type and format.

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Please login or Register to Submit Answer