EnergieProduction / Chart

Chart service for Highcharts on Laravel 5
https://energie-production.fr/
7 stars 0 forks source link

How to use plotLines under Y-axis for plot average lines #1

Open ajay-patidar opened 6 years ago

ajay-patidar commented 6 years ago

How to use plotLines under Y-axis for plot average lines

plotLines: [{
    color: 'red',
    value: '81.5', // Insert your average here
    width: '1',
    zIndex: 2 // To not get stuck below the regular plot lines
}]

I have added this by two ways below

$chart->pushSubset('yAxis', function($title){
    $title->pushCriteria(new Criterias\Max(100));
    $title->pushCriteria(new Criterias\Min(0));
    $title->pushCriteria(new Criterias\TickInterval(10));

    $title->pushSubset('plotLines', function($plotLines){
        $plotLines->pushCriteria(new Criterias\Color('red'));
        $plotLines->pushCriteria(new Criterias\Value(80));
        $plotLines->pushCriteria(new Criterias\Width(1));
        $plotLines->pushCriteria(new Criterias\ZIndex(2));
    });
});

OR

$chart->pushSubset('plotLines', function($plotLines){
    $plotLines->pushCriteria(new Criterias\Color('red'));
    $plotLines->pushCriteria(new Criterias\Value(80));
    $plotLines->pushCriteria(new Criterias\Width(1));
    $plotLines->pushCriteria(new Criterias\ZIndex(2));
});

But Its creating object of plotline

plotLines: {
    color: 'red',
    value: '81.5', // Insert your average here
    width: '1',
    zIndex: 2 // To not get stuck below the regular plot lines
}

I need to create it as a array.

plotLines: [{
    color: 'red',
    value: '81.5', // Insert your average here
    width: '1',
    zIndex: 2 // To not get stuck below the regular plot lines
}]

Please help me.

Thanks

DeGraciaMathieu commented 6 years ago

Sorry, it is not currently possible :( Maybe in a next version