kevinkhill/lavacharts

Adding data descriptions on the X axis

lukpeta opened this issue · 1 comments

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

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

or use addRows()