How to programmatically set a Views display to override style options I am working on the Charts module and have a stubborn issue that I'm trying to resolve.

Charts provides a Views style plugin and a Views display plugin called Chart Attachment. The display plugin extends the Attachment display plugin and sets the View's format to Charts. However, I run into an issue where I really need the Chart Attachment's formatting settings to apply to its display only ("This chart_extension (override)"). If it applies to all displays, it ends up breaking the Chart because the whole idea behind the Chart Attachment is for it to be different than its parent.

Here is what the Format settings should look like immediately after clicking "Add" -> "Chart attachment" in the View displays section:



Note the italic font on Chart and Settings within the Format section.

When you click on Chart from that attachment, this is what you should see without clicking anything else:



So how can one code the Display plugin to enforce style format options to "This chart_extension (override)"?

Or, if there is another approach that accomplishes the same thing, I would be open to that.
This is how you can achieve that:

diff --git a/src/Plugin/views/display/ChartsPluginDisplayChart.php b/src/Plugin/views/display/ChartsPluginDisplayChart.php
index 3dbad31..68048ce 100644
--- a/src/Plugin/views/display/ChartsPluginDisplayChart.php
+++ b/src/Plugin/views/display/ChartsPluginDisplayChart.php
@@ -29,6 +29,10 @@ class ChartsPluginDisplayChart extends Attachment {
     $options['style_plugin']['default'] = 'chart';
     $options['inherit_yaxis'] = ['default' =&gt; '1'];

+    // Set the default style plugin to 'chart'.
+    $options['style']['contains']['type']['default'] = 'chart';
+    $options['defaults']['default']['style'] = FALSE;
+
     return $options;
   }


API docs:
https://api.drupal.org/api/drupal/core%21modules%21views%21src%21Plugin%21views%21display%21DisplayPluginBase.php/function/DisplayPluginBase%3A%3AdefineOptions/8.2.x