I have a requirement to show data in pie chart, based on User input date range.

I have already achieved that, but my date selection window is overridden by the background of the pie chart.Is there any way to set z-index for me?

enter image description here

How can I fix this styling?

<p>Date Range:
        <input type="text" id="datepicker" onclick="phantom_back"> to
        <input type="text" id="datepicker2" onclick="phantom_back"> </p>

<div id="chartContainer" style="height: 370px; width: 100%;z-index: -1;background-color: #000000;" ></div>
<div id="keyMessageChartContainer" style="height: 370px; width: 100%;z-index: 102;"></div>

var startDate;
    var endDate;
    var start;
    var end;

    function phantom_back(image)
                document.getElementById('datepicker').style.height = 700;
                document.getElementById('datepicker').style.width = 700;
                document.getElementById('datepicker').style.zIndex = 50;
                document.getElementById('datepicker2').style.height = 700;
                document.getElementById('datepicker2').style.width = 700;
                document.getElementById('datepicker2').style.zIndex = 50;

        function phantom_top()
                document.getElementById('chartContainer').style.height = 600;
                document.getElementById('chartContainer').style.width = 600;
                document.getElementById('chartContainer').style.visibility = "visible";
        $(function() {
                onSelect: function() {
                    startDate = $(this).datepicker('getDate');
                    start = formatDate(startDate);

                onSelect: function() {
                    endDate = $(this).datepicker('getDate');
                    end = formatDate(endDate);
                    alert('skn here s' + startDate);
                    alert('skn here e' + endDate);
                    getCurrentAccountId2(start, end);


  • Hide the pie chart whenever you enter the date fields – Caspar Harmer Dec 7 '17 at 22:36
  • How can I do that? Pie chart blocks a place in canvas. – user3919803 Dec 8 '17 at 2:50
  • Can someone please help me here~? – user3919803 Dec 8 '17 at 6:10
  • document.getElementById('chartContainer').style.visibility = "none"; – Caspar Harmer Dec 8 '17 at 21:52
up vote 1 down vote accepted

To expand on my comments, add an onfocus and an onblur listener to your inputs eg:

<input type="text" id="datepicker" onfocus="{!c.handleOnfocus}"> 

Define your handleOnfocus method similar to this:

handleOnfocus: function (component,event,helper){
  var el = event.target;
    el.style.visibility = "none"; 

In your onblur handler, it would be similar, except you'd make the visibility property something like visible

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.