Giter Club home page Giter Club logo

charts's Introduction

TYPO3 Extension charts

Version Tests Coverage License Documentation

composer req hoogi91/charts

Features

  • Supporting editors & authors by providing
    • records to create data for charts incl. labels, data and dataset-labels
    • fluid based content elements to display charts (bar, line, pie or doughnut) in frontend
    • (optional) fill data records for charts with informations from spreadsheets when spreadsheet extension is present in TYPO3 installation
  • Supporting administrators & developers by providing
    • select option in extension manager to manage/set the preferred chart library
    • registry to add multiple chart libraries implementing at least the Hoogi91\Charts\DataProcessing\Charts\LibraryInterface
    • DataProcessors to get chart data, assets and their settings from Flexform configuration

Contribution

Pull Requests are gladly welcome! Nevertheless please don't forget to add an issue and connect it to your pull requests. This is very helpful to understand what kind of issue the PR is going to solve.

Bugfixes: Please describe what kind of bug your fix solve and give us feedback how to reproduce the issue.

Features: Not every feature is relevant for the bulk of users. It helps to have a discussion about a new feature before you open a pull request.

charts's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar hoogi91 avatar saitho avatar thenaderio avatar vte-udg avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

charts's Issues

Issue while loading chartjs.js file

Version(s) affected: 3

Description
There is currently a bug in the Hoogi91\Charts\DataProcessing\Charts\Library\ChartJs class. The JavaScript file is not being loaded in TYPO3 12 due to an incorrect path. As a result, the charts are not appearing in the frontend.

How to reproduce
image

Possible Solution
Use EXT: in path:
image

PHP 8.3 support

Hi @hoogi91,

PHP 8.2 will only be receiving security updates starting the next year.
We're currently looking into upgrading our projects to PHP 8.3.

This extension is currently restricted to PHP 8.1 and 8.2.
Can you allow PHP 8.3 in the dependencies, or are there known issues with that PHP version?

Kind regards
Mario

ChartJS Option Step Size not recognized

Version(s) affected: all

Description
ChartJS option step size has no effect in frontend

How to reproduce
Using "Automatic calculation" and "Step Size" for x-axis together results in auto-calculated ticks.

Possible Solution
Changing javascript to support custom step size on automatic calculation.

Class Hoogi91\Spreadsheets\Service\ExtractorService does not exist

Version(s) affected: 2.0.5
TYPO3 10.4.27

Description
After doing a fresh installation, adding a simple dataset and adding a plugin with this data in backend, I get a Class Hoogi91\Spreadsheets\Service\ExtractorService does not exist. Reflection failed. in BE and FE.

Possible Solution
The installation of EXT:spreadsheet does help. But as I understand the documentation, it is not mandatory to install EXT:spreadsheet.

Can't bring Extension to work - no Output is shown. Probably some requirement is missing, but isn't listed anywhere

Version(s) affected:
charts: 1.0.4
typo3: 9.5.*

Description
I can't bring the Extension to output anything. I tried without Spreadsheet and with Spreadsheet. I used Charts.js for FE output, but didn't work with Chartist either. Output is Empty.
If I use Spreadsheet and try to craete some data (by opening the Table wizard) only the checkbox "Small fields" is shown.
image

Also I saw some attributes of the content element, which I didn't had a form field for:
image
I don't have a field for Cutout Percentage and Legend.

I tried it with a clean typo3 9.5.11 instance.

How to reproduce
Require charts and spreadsheet with composer under TYPO3 9.5.* (I tried 9.5.11 and 9.5.9). Create a new chart dataset in the list module, click on the table symbol. --> empty form wizard should show.
create a new chart content element and add a chart dataset, open FE --> nothing should be shown

I assume I'm missing some requirement, but it isn't listed anywhere.
Anyone an idea what causes the problem?

Thanks in advance

Backend preview cannot be rendered with PHP 8(.1)

Version(s) affected:
2.0.6

Description
image

How to reproduce

  1. composer require hoogi91/charts --no-dev
  2. Create diagram data
  3. create chart content element (line, bar, ... doesn't care)
  4. open page in site-view

Possible Solution

Update code to be PHP >8 compatible

Additional context
If installed without --no-dev, the "spreadsheets" extension will be installed and you cannot even create the diagram-data record due to PHP 8 errors

Plain dataset charts are missing some labels

Version(s) affected: 2.0.0+

Description
We're using a plain dataset record with two labels ("Label 1", "Label 2"). However only the first label is displayed in frontend.

missing-label2

How to reproduce

Chart Dataset:

Labels:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3TableWizard>
    <numIndex index="2" type="array">
        <numIndex index="2">97</numIndex>
        <numIndex index="4">98</numIndex>
        <numIndex index="6">99</numIndex>
        <numIndex index="8">00</numIndex>
        <numIndex index="10">01</numIndex>
        <numIndex index="12">02</numIndex>
        <numIndex index="14">03</numIndex>
        <numIndex index="16">04</numIndex>
        <numIndex index="18">05</numIndex>
        <numIndex index="20">06</numIndex>
        <numIndex index="22">07</numIndex>
        <numIndex index="24">08</numIndex>
        <numIndex index="26">09</numIndex>
        <numIndex index="28">10</numIndex>
        <numIndex index="30">11</numIndex>
        <numIndex index="32">12</numIndex>
        <numIndex index="34">13</numIndex>
        <numIndex index="36">14</numIndex>
        <numIndex index="38">15</numIndex>
        <numIndex index="40">16</numIndex>
        <numIndex index="42">17</numIndex>
        <numIndex index="44">18</numIndex>
        <numIndex index="46">19</numIndex>
        <numIndex index="48">20</numIndex>
    </numIndex>
</T3TableWizard>

Datasets:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3TableWizard>
	<numIndex index="2" type="array">
		<numIndex index="2">300</numIndex>
		<numIndex index="4">310</numIndex>
		<numIndex index="6">340</numIndex>
		<numIndex index="8">420</numIndex>
		<numIndex index="10">410</numIndex>
		<numIndex index="12">430</numIndex>
		<numIndex index="14">410</numIndex>
		<numIndex index="16">440</numIndex>
		<numIndex index="18">480</numIndex>
		<numIndex index="20">540</numIndex>
		<numIndex index="22">600</numIndex>
		<numIndex index="24">610</numIndex>
		<numIndex index="26">510</numIndex>
		<numIndex index="28">540</numIndex>
		<numIndex index="30">620</numIndex>
		<numIndex index="32">610</numIndex>
		<numIndex index="34">630</numIndex>
		<numIndex index="36">660</numIndex>
		<numIndex index="38">710</numIndex>
		<numIndex index="40">720</numIndex>
		<numIndex index="42">780</numIndex>
		<numIndex index="44">850</numIndex>
		<numIndex index="46">900</numIndex>
		<numIndex index="48">950</numIndex>
	</numIndex>
	<numIndex index="4" type="array">
		<numIndex index="2">400</numIndex>
		<numIndex index="4">410</numIndex>
		<numIndex index="6">440</numIndex>
		<numIndex index="8">520</numIndex>
		<numIndex index="10">510</numIndex>
		<numIndex index="12">530</numIndex>
		<numIndex index="14">510</numIndex>
		<numIndex index="16">540</numIndex>
		<numIndex index="18">580</numIndex>
		<numIndex index="20">640</numIndex>
		<numIndex index="22">700</numIndex>
		<numIndex index="24">710</numIndex>
		<numIndex index="26">610</numIndex>
		<numIndex index="28">640</numIndex>
		<numIndex index="30">520</numIndex>
		<numIndex index="32">510</numIndex>
		<numIndex index="34">530</numIndex>
		<numIndex index="36">560</numIndex>
		<numIndex index="38">710</numIndex>
		<numIndex index="40">620</numIndex>
		<numIndex index="42">780</numIndex>
		<numIndex index="44">950</numIndex>
		<numIndex index="46">800</numIndex>
		<numIndex index="48">850</numIndex>
	</numIndex>
</T3TableWizard>

Dataset Labels:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3TableWizard>
	<numIndex index="2" type="array">
		<numIndex index="2">Label 1</numIndex>
		<numIndex index="4">Label 2</numIndex>
	</numIndex>
</T3TableWizard>

Possible Solution

Hoogi91\Charts\Domain\Model\ChartDataPlain::getDatasetsLabels grabs the first column of $labels:

public function getDatasetsLabels(): array
{
    // grab first column of every row as dataset labels in plain element
    $labels = $this->extractLabelList($this->datasetsLabels);
    return array_column($labels, '0') ?? [];
}

For the XML above $labels is [['Label 1', 'Label 2']].
By running array_column($labels, '0') the method will return only ['Label 1']

Fatal error on extension configuration called via backend

Version(s) affected: 1.1.2 / 2.0.0

Description
The extension triggers a fatal error while accessing the extension configuration via TYPO3 backend when trying to include a nonexistent file.

How to reproduce

  • Install extension via composer
  • Access Settings -> Extension Configuration via TYPO3 backend.

Possible Solution
Change code in Classes/DataProcessing/Charts/LibraryRegistry.php on line 24 to $autoloader = require Environment::getProjectPath() . '/vendor/autoload.php';

Additional context
Currently, the code on line 24 returns the webroot which should be the projectroot instead.

Override color information from spreadsheets

Hi, great Extension.

It would be cool to change the colors of the chart without messing with the spreadsheet itself.
Something like a colormatrix override.

I tried it by extending the ChartDataSpreadsheet model with a custom colormatrix field and used the table input TCA feature.

Background;Border

Instead of assigning the color information from the cells, the color matrix is read first.

image

Limit the width of the legend texts

Hi,
As you can see, one of the labels is very long, which makes the chart unusable.
I would like to have a way to set the maximum size of the legend, probably in pixels or have only 1 column of labels
image007_050220_124451_PM

ChartData getDatasetsLabels is suppressing the last configured label.

Hi everyone.

The Hoogi91\Charts\Domain\ModelChartData::getDatasetsLabels is suppressing the last configured label.

As can be seen here, the last configured label will never be accessible.
The array_shift always removes the last label.
According to the comment, this is done intentionally, so it's not a bug.

Why is the last label being removed?
Can the array_shift be removed or bypassed?

Tobi

Remove the usage of the cache_charts_data.

Hi Thorsten.

When you render too many charts on one page, the database will quit with a

The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.

We have added more than 15 of them on one page (using a form to decide what to display).
Even with a disabled frontend cache, your code is extremely fast. ๐Ÿ˜„

Tobi

Missing RenderType for all FlexFrom select fields

Version(s) affected: 1.1.0

Description
Every Position select field missing a renderType selectSingle

How to reproduce
Create a new Chart CE, in the FlexForm the position select field causes Unknown type: select, render type: select

Possible Solution
Add to every select that is a single select the renderType <renderType>selectSingle</renderType>

Missing extension options in BE

Version(s) affected: 2.0.6 (and before)
TYPO3 10.4.28

Description
When doing a fresh installation, the extension options in BE for legends and more are missing.

Possible Solution
Changing in extension options from default apexcharts to chartjs (and back) and saving the content element again (no change needed).

Wrong (same) coloring of data

Version(s) affected: 1.1.3
TYPO3 10.4
PHP 7.3

Description
Because of PHP 7.3 on the target system I had to revert to version 1.1.3 of EXT:charts. Apexcharts (which I preferred before) is not yet implamented so I tried chartist (has no legends) and now I'm using chartjs. (I miss the option to define my own colors, nice feature.) But by using chartjs all graphs are using the same color, a kind of red. Do I have any chance to get rid of this error?

ColorPicker not working on Firefox

Version(s) affected: 2.0.0

Description
Firefox V 97.0 (64-Bit) triggers function not found exceptions in javascript console when accessing the modal

How to reproduce

  • Start firefox
  • Open a dataset from Listview
  • Try to use the colorpicker

Possible Solution
Seems like firefox is not interpreting JavaScript arrow functions correctly and does not maintain the overlaying JavaScript Class as "this" inside eventlistener callbacks. bind(this) could be a solution but requires a lot of code refactoring.

Additional context
There is another small issue around the colorpicker. If you created a new palette, the palette would show up in the backend. The element which holds and displays the color as a bar, has a height of 32px which is ignored due to the elements inline nature. Add display: block as additional css rule (Classes/Form/Element/ColorPaletteInputElement.php line 47) to display the bar as desired.

fixEmptyConfiguration may cause an error

Hi everyone.

Version(s) affected: 1.1.0

Description
The class Hoogi91\Charts\Controller\Wizard\TableController tries to fix empty values with the method fixEmptyConfiguration.
This method gets it's $configuration from the TYPO3\CMS\Backend\Controller\Wizard\TableController::getConfiguration, and expects an array. The problem is that the method may return an object instead.

See: https://github.com/hoogi91/charts/blob/1.1.0/Classes/Controller/Wizard/TableController.php#L47
And: https://github.com/TYPO3/TYPO3.CMS/blob/v10.4.4/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php#L251

How to reproduce
Not sure if I can be helpful here. I'm only able to reproduce this with the save_close_ce extension and when save_and_close'ing one of our custom record.

But . . .
See: https://github.com/TYPO3/TYPO3.CMS/blob/v10.4.4/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php#L294
Here we have the save and close action, which may (or may not) return an object instead of an array. It does not happen with all of records types.

Looks like the core devs have the save_and_close action forgotten in there.

Possible Solution
Either declare save_close_ce incompatible, or test if you are handling an array.

Tobi

LibraryRegistry doesn't support DI

Version(s) affected:

1.1.0, TYPO3 10.4

Description

To display a list of registered chart libraries in the extensions settings, LibraryRegistry is loading ext_localconf.php of all loaded extensions. Unfortunately by just loading the configurations via ExtensionManagementUtility the dependency injection (DI) is not supported and if classes used in ext_localconf.php depend on that, an ArgumentCountError occurs in the extension configuration module.

How to reproduce

Prepare a TYPO3 10.4 installation and install charts 1.1.0 and evoweb/extender 7.x, then try to open extension configuration module.

Possible Solution

Adapt required bootstrapping in LibraryRegistry.

Additional context

Details about the exception to expect when trying to reproduce:

(1/1) ArgumentCountError

Too few arguments to function Evoweb\Extender\Utility\ClassLoader::__construct(), 0 passed in /var/www/html/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3481 and exactly 2 expected

Content Elements cannot be copied and inserted with charts installed

Version(s) affected: 10.0.2
Running on TYPO3 9.5.9

Description
After installing charts 1.0.2 copying and inserting a content elment creates the following error messages:

2: SQL error: 'Incorrect integer value: '' for column db.tt_content.tx_charts_chartdata at row 1' (tt_content:NEW5d8dac251e71e122382317)
1: Attempt to insert record on page '[root-level]' (0) where this table, tt_content, is not allowed

How to reproduce
Make a plain installation on TYPO3 9.5.9
install charts 1.0.2 form TER
create an arbitary content element on one page i.e. text with media, copy it in the page module and insert it. Two error messages (above) will appear, content element doesnt get inserted

Possible Solution
after uninstalling extension charts the error disappears. installing it again and the error can be reproduced once more

Additional context
charts-error
typo3-9-5-7-with-charts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.