- Issue created by @stefan.korn
- Merge request !163Issue #3535826: Provide config option for title font size β (Open) created by stefan.korn
- πΊπΈUnited States andileco
Thank you for your recent contributions, @stefan.korn! Would you be willing to do a quick assessment of which libraries support setting the title font size? If it's not available with all of them, we may want to do something similar to the other issue you worked on with the color changer.
- π©πͺGermany stefan.korn Jossgrund
From looking at the code only Chartjs and Google seem to use this (not checked if other libraries themself might support setting title font size, but have not been implemented in the module). Then yes, it is just like with the color changer. Bringing in an option for all libraries that is not available for all libraries. Though the 'title_font_size' looks like a global option. That is what made me think it is used for all libraries. But surely it is not that easy.
I am currently working with Chartjs and trying to provide an interface for the users that is aligned with what Chartjs can do. So I am biased in this way.
Your idea from π Color Changer - only valid for Highcharts? Active to have libraries indicate their possibilities and settings somehow is very interesting and would surely be a good solution.
As there are many options and many libraries this might be a rather tedious task, but makes sense of course.
- πΊπΈUnited States andileco
Thank you for your work on this, @stefan.korn! I know you haven't marked this as "Needs review" yet, but I see an issue and wanted to suggest an alternative approach.
Before I do that: the issue is that I looked into the other charting libraries that are bundled in the Charts module, and it seems like most don't actually have a lot of styling options for title and subtitle, including font size. Highcharts, which is probably the reason the title_font_size key exists, no longer has a title font size option in their API because the library automatically adjusts the font size based on the amount of text and the size of the chart.
So, I don't want to add fields where they don't do anything and the user thinks something is broken when in actuality the field was just for a different charting library. These types of fields DO exist in the module (e.g. "Make the chart three-dimensional"), but only for historical reasons, and I have unwritten plans to remove them in a later version.
What I think you should do is refactor at least some of your code into the "addBaseSettingsElementsOptions()" method in Chartjs.php (you may need to add it, but you can look to Highcharts.php for an example of how to do so). This will make the settings for title/subtitle font size appear as soon as "Chart.js" has been selected as your library. There's a video about this here: https://www.linkedin.com/posts/daniel-cothran-43878218_drupal-charts-dat... and there are several recent issues about it, too: https://www.drupal.org/project/charts/issues/3458753 β¨ Add support for PieChart colorAxis options Active , https://www.drupal.org/project/charts/issues/3528781 β¨ Add StackLabel option for Highcharts Active , and https://www.drupal.org/project/charts/issues/3493686 π Billboard and C3 not using custom colors for Pie or Donut charts Active .
Please let me know what you think!
- π©πͺGermany stefan.korn Jossgrund
@andileco: Thanks for your input. I fully agree about this:
So, I don't want to add fields where they don't do anything and the user thinks something is broken when in actuality the field was just for a different charting library.
At the moment I am just tweaking charts solely towards chartjs to make use of options chartjs provides. Due to a somewhat tight deadline on this, I was not able to get in depth to adress the issue you mentioned. Because checking all the libraries for what they can do against options provided by the module seems really a lot of work.
But many thanks for the hint about "addBaseSettingsElementsOptions()" just for the chartjs module. This seems very interesting and maybe this way I can go forward with modifications for chartjs in the first place and maybe later address other libraries too and do refactoring of configuration options like you mentioned for the "three dimensional chart" in another issue.