Can I put title and legend on the same line?

Hello SyncFusion,

I have same rather flat bar charts. I am thinking move the Title to upper-left and move the legend to the same line as the title on the upper-right.

Can it be done? and How?

Thanks,

John




3 Replies 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team December 23, 2021 12:34 PM UTC

Hi John, 

Greetings from Syncfusion. 

We recommend you to specify legend position as Custom to place the legends in required position using x, y coordinates and textAligment as Near to display chart title in left. Please check with the below snippet and sample. 

<ejs-chart :legendSettings='legendSettings' :titleStyle='titleStyle'></ejs-chart> 
export default Vue.extend({ 
name: 'app', 
data: function() { 
    return { 
        legendSettings: { 
            visible: true, 
            position: 'Custom', 
            location: { x: 580, y: 5 } 
      }, 
      titleStyle :{textAlignment: 'Near'} 
   }; 
} 
}); 

 



Please revert us if you have any concerns. 

Regards, 
Durga G 



JC John Chen December 23, 2021 05:11 PM UTC

Hi Durga,

Your suggestion worked.

But, my charts are resizable. I end up putting the Legend on the left and Title on the right (Far). This way, I avoided
a) recalculating the x. 
b) The title, if align as Near, is too much to the left edge (don't now how to pad) 

Thanks for the help.


John



DG Durga Gopalakrishnan Syncfusion Team December 27, 2021 12:56 PM UTC

Hi John,


Most welcome. We request you to use chart loaded event to change the position of chart title based on your need. We have attached modified sample for your reference. Please check with below snippet and sample.


methods:{

              loaded: function (args) { 

                             var titleEle= document.getElementById("chartcontainer_ChartTitle");

                             if(titleEle != null)

                                      titleEle.setAttribute("x", 50);   

                }

  }


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/TitlePosition1290097237.zip


Kindly revert us if you have any concerns.


Regards,

Durga G


Marked as answer
Loader.
Up arrow icon