KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

ApexCharts - not possible to show duplicated category labels on bar chart #3355

Open Filip opened this topic on on Oct 15 - 3 comments

Filip commented on Oct 15

Hi, regardless setting showDuplicates => true in label option array I can't display duplicate labels on my category axis:

                       "xaxis"=>array(
                           "categories" => $cat,
                        
                           "labels"=>array(
                              "show" => true,
                              "maxWidth" => 300,
                              "showDuplicates" => true,
                              
                           ))

Option was used according to: https://apexcharts.com/docs/options/xaxis/

What I'm doing wrong ?

Bright commented on Oct 16

Do you want to show duplicate labels in "categories" or "dataSource" ? Only duplicate labels can be displayed in the data of "dataSource"

Filip commented on Oct 16

Hi Bright, I have quite specific case - due to the need of displaying labels in multiple lines (issue #3352), I'm forced to migrate labels from SQL query (my dataSource) to an array and overwrite labels in categories instead using them directly from dataSource, and here comes the problem - if I use dataSourcde as you mentioned - no problem with duplicates, but if I use labels from array even with showDuplicates I'm failing...

Concluding - I have no choice if I want use multilie - I need use category, but category doesn't let me show duplicates... Any workaround... ? It seems native ApexCharts are allowing to do it using showDuplicates in xaxis options array.

Bright commented on Oct 16

Can I see your $data and $cat data?

When I pass the data into the dataSource as an array and the category names as a string array, it can satisfy your two requirements of duplicate and line break without resorting to "categories" in "xaxis"

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

ApexCharts