Change color of chart axis font and labels ( light theme and dark theme)

Hi

 We have our own light theme and dark theme , and for syncfusion charts to adopt those theme i have to update the color for the chart axis labels. and legend labels,etc. Refer followinf



9 Replies

SM Srihari Muthukaruppan Syncfusion Team July 1, 2021 09:00 AM UTC

Hi Jitendra, 

We can achieve your requirement using labelStyle and textStyle property in the axis and legendsettings respectively. Based on that we have prepared a sample for your reference. We also attached the documentation link for your reference. Please find the sample, UG link, code snippet and screenshot below. 

 
Code Snippet: 
<ejs-chart style='display:block' [legendSettings]="legendSettings" align='center' id='chartcontainer' 
            [primaryXAxis]='primaryXAxis' [primaryYAxis]='primaryYAxis' [tooltip]='tooltip' (load)='load($event)' 
            [chartArea]='chartArea' [width]='width'> 
            <e-series-collection> 
                <e-series [dataSource]='data' type='Line' xName='x' yName='y' name='Germany' width=2 [marker]='marker'> 
                </e-series> 
            </e-series-collection> 
        </ejs-chart> 
 
// add your additional code here 

public primaryXAxis: Object = { 
    valueType: 'DateTime', 
    labelStyle: { 
      size: '14px', 
      color: 'white', 
      fontFamily: 'Segoe UI', 
      fontWeight: 'bold' 
    }, 
  }; 
  public primaryYAxis: Object = { 
    labelStyle: { 
      size: '14px', 
      color: 'white', 
      fontFamily: 'Segoe UI', 
      fontWeight: 'bold' 
    }, 
  }; 

public legendSettings: Object = { 
    textStyle: { 
      size: '14px', 
      color: 'white', 
      fontFamily: 'Segoe UI', 
      fontWeight: 'bold' 
    } 
  }; 

// add your additional code here 



Screenshot: 
 

Let us know if you have any concerns. 

Regards, 
Srihari M 



JC Jitendra Chaudhari August 4, 2021 11:27 AM UTC

How to change color of period selector also why unselected region in range nvaigator does have grey shading

need fix for :

  1. color of period selector as per theme 
  2. remove grey shades from unselected region
  3. labels (months) color as per theme 




DG Durga Gopalakrishnan Syncfusion Team August 5, 2021 03:11 PM UTC

Hi Jitendra , 

We have prepared sample based on your requirement with Highcontrast theme. By default, based on provided theme period selector, unselected region and labels color will be changed automatically. Please check with the below sample and screenshot. 

 


Kindly ensure whether you have specified color for unselected region and labels.  

Regards, 
Durga G


JC Jitendra Chaudhari August 16, 2021 01:40 PM UTC

Thanks for your reply it worked partially. 

As we are having our own themes as per our design system, i prefer not to use highcontrast theme.

i can achieve with above solution is :



But still labels and the bar of period selector is open issue for me.

also i need to change color of grouping bar as well as pagination bar for data grid 




DG Durga Gopalakrishnan Syncfusion Team August 17, 2021 03:26 PM UTC

Hi Jitendra, 

Thanks for an update. Please check with below suggestions. 

# 1 : labels and period selector 

We request you to change the color of unselected region and labels using the properties navigatorStyleSettings and labelStyle. By default, period selector color will be changed based on specified theme. If you want to specify different color, you can use toolbar class name to change the color. We have modified sample and attached for your reference.  

<ejs-rangenavigator  [labelStyle]='labelStyle' [navigatorStyleSettings]='navigatorStyleSettings' > 
</ejs-rangenavigator> 
<style> 
.e-toolbar .e-toolbar-items{ 
     
} 
</style> 
 
public labelStyle: Object = { color: 'white'}; 
public navigatorStyleSettings: Object = { 
        unselectedRegionColor: 'transparent', 
        selectedRegionColor: 'rgba(121, 236, 228, 0.3)' 
}; 


UG :  

# 2 : to change color of grouping bar as well as pagination bar for data grid 
 
Based on your query, we could see that you want to customize the group drop area and pager element in the Grid. For this we suggest use below CSS to achieved your requirement. 
   /* Group drop area */ 
    .e-grid .e-groupdroparea { 
        background-color: #607d8b; 
    } 
    /* Grid pager root element*/ 
   .e-grid .e-gridpager { 
        background-color: #607d8b; 
    } 

We have prepared a sample based on this for your reference,
 
 
Please find the documentation for apply customization in Grid.  

Kindly revert us if you have any concerns. 

Regards, 
Durga G 



JC Jitendra Chaudhari August 20, 2021 08:49 AM UTC

still there are some issues. got pager container


:root { --groupheader-colorvar(--element-ui-1); }
.e-grid .e-table {
  background-colorvar(--element-base-1!important;
}
.e-grid .e-rowcell {
  colorvar(--element-ui-1!important;
}

/* Group drop area */
.e-grid .e-groupdroparea,
.e-grid .e-groupdroparea.e-hover,
.e-grid .e-groupdroparea.e-grouped {
  background-colorvar(--element-base-1);
}
/* Grid pager root element */
.e-grid .e-gridpager {
  background-colorvar(--element-base-1);
}

.e-pager .e-pagercontainer {
  background-colorvar(--element-base-1!important;
}
.e-grid .e-headercell.ViridianGreen{
  background-color#009999;
  colorwhite;
  font-size40px;
  font-weight800;
}
.e-grid .e-headercell.Brown{
  background-color#c67954;
  colorwhite;
  font-size40px;
  font-weight800;
}
.e-grid .e-headercell.Blue{
  background-color#5473c6;
  colorwhite;
  font-size40px;
  font-weight800;
}
.e-grid .e-headercell.Green{
  background-color#72c654;
  colorwhite;
  font-size40px;
  font-weight800;
}
.e-grid .e-headercell.Violet{
  background-color#bc54c6;
  colorwhite;
  font-size40px;
  font-weight800;
}
.e-grid .e-headercell.LightBlue{
  background-color#54bac6;
  colorwhite;
  font-size40px;
  font-weight800;
}

.e-grid .e-groupdroparea.e-grouped {
  background-colorvar(--element-ui-4) ;
}

.e-grid .e-groupheadercell{
  background-colorvar(--groupheader-color) ;
}

.e-grid .e-indentcell {
  background-colorvar(--element-ui-4) ;
  border-colorwhite;
}

.e-grid .e-recordplusexpand {
  background-colorvar(--element-ui-4) ;
  border-colorwhite;
}

.e-grid .e-groupcaption {
  background-colorvar(--element-ui-4) ;
  border-colorrgb(245242242);
}

.e-grid .e-recordpluscollapse {
  background-colorvar(--element-ui-4) ;
  border-colorrgb(245242242);
}

.column-alignment {
  align-itemscenter;
}





How to apply highcontrast or other theme to grid..i tried theme="XX"



DG Durga Gopalakrishnan Syncfusion Team August 23, 2021 12:33 PM UTC

Hi Jitendra, 

Based on your query, we could see that you want to change the theme to the Grid UI. The Syncfusion JavaScript library has provided the following list of built-in themes, They are Google’s Material, Microsoft Office’s Fabric, Bootstrap and High Contrast. You can customize the theme as you want by following the below documentation.  

Documentation:  

Regards,  
Durga G 



JC Jitendra Chaudhari replied to Durga Gopalakrishnan August 23, 2021 12:38 PM UTC

i dont want to use your theme but i want to customize ..when i tried to overwrite page container css 

.e-pager .e-pagercontainer {
  background-colorvar(--element-base-1!important;
}


its not working 



SK Sujith Kumar Rajkumar Syncfusion Team August 24, 2021 12:25 PM UTC

Hi Jitendra, 
 
We checked your reported problem from our end but unfortunately were unable to reproduce it as the background styles were properly applied for the Grid’s pager with the shared code snippet. You can also apply background for the pager’s child elements using the below code snippet, 
 
.e-pager .e-pagercontainer, .e-pager .e-pagercontainer div { 
    background-color: #c2ef10 !important; 
} 
 
Please find the below modified sample for your reference, 
 
 
We suspect that you might be facing the problem because of the variable from which you are accessing the background color code not returned properly. So we suggest you to ensure this case by providing the color code directly to the background style property as shown in the above code snippet. 
 
If problem still persists then please share us the following information to validate further on this, 
 
  • Share us the color code value returned in the specified variable.
  • Syncfusion package version used.
  • If possible share us a simple sample to replicate the problem or try reproducing it in the above provided sample.
 
Let us know if you have any concerns. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon