fxcosta / laravel-chartjs

Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library
485 stars 113 forks source link

Allowing "raw options". #21

Closed Damian89 closed 7 years ago

Damian89 commented 7 years ago

Since the current version allows it to add simple json string based options, it is not possible to generate options like:

    options: {
        scales: {
            xAxes: [{
                type: 'time',
                time: {
                    displayFormats: {
                        quarter: 'MMM YYYY'
                    }
                }
            }]
        }
    }

Using the method optionsRaw(string) its possible to add a the options in raw format:

        $chart->optionsRaw = "{
            legend: {
                display:false
            }, 
            scales: {
                xAxes: [{
                    gridLines: {
                        display:false
                    }  
                }]
            }
        }";

I'm using my own helper, but its basically just passing this string into "optionsRaw".

Its not the best solution, but it works well ;)

fxcosta commented 7 years ago

@Damian89 great!! merged, thanks for support!