Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding data descriptions on the X axis #338

Open
lukpeta opened this issue May 13, 2021 · 1 comment
Open

Adding data descriptions on the X axis #338

lukpeta opened this issue May 13, 2021 · 1 comment

Comments

@lukpeta
Copy link

lukpeta commented May 13, 2021

Hi,
I am beginner in php.
I make my project with Laravel 8. I have this code:

`$names = [];
$data = [''];

    foreach ($items as $item) {
        array_push($names, ['number', $item->item->name . ' [' . $item->item->short_name . '] - '. $item->weight_sum]);
        array_push($data, $item->weight_sum);
    }

    $imgItems = \Lava::DataTable();

    $imgItems
        ->addStringColumn('Description')
        ->addColumns($names);

    $imgItems->addRow($data);

    \Lava::ColumnChart('imgitems', $imgItems, [
        'title' => 'Raport',
        'height' => 1000,
        'width' => 2000,
        'legend' => [
            'position' => 'right'
        ],
        'titleTextStyle' => [
            'color' => '#eb6b2c',
            'fontSize' => 14
        ],
        'events' => [
            'ready' => 'getImageCallback'
        ]
    ]);`

In result I have: https://ibb.co/j4ghGL6

I need to add descriptions under the graph lines as in the screenshot: https://ibb.co/gb0XyMd

How can I do this?

Please help

@kevinkhill
Copy link
Owner

Upon first glance, move the addRow call to inside of your foreach so that you add more than one row.

or use addRows()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants