Skip to content

line not drawing in mscombi2d #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GuusPunt opened this issue Jan 30, 2018 · 3 comments
Open

line not drawing in mscombi2d #47

GuusPunt opened this issue Jan 30, 2018 · 3 comments

Comments

@GuusPunt
Copy link

GuusPunt commented Jan 30, 2018

linenotvisible
linevisible

I've created my first chart after a day testing. It's a combi chart (2 bar series , 1 line serie)

After updating the datasource from my controller, the bar series always get drawn and updated. However the line does not.

The line chart gets updated/drawn random( 50% visible, 50% not visible)

Update:
vm.myDataSource.dataset[2].data = [{"value":"16610.88"},{"value":"16610.88"},{"value":"16610.88"},{"value":"16610.88"},{"value":"41524.72"},{"value":"1.66"},{"value":"1.66"},{"value":"1.66"},{"value":"1.66"},{"value":"1.66"},{"value":"-8302.95"},{"value":"-8302.95"}];

I print my bar data after every update : console.log(JSON.stringify(vm.myDataSource.dataset[2].data));

It shows the exact data from the dataset every time but the line not always get drawn. Any hints or clue's would be appreciated. Addionatinol info needed plz let me know.

(Not an angular expert )

@GuusPunt GuusPunt reopened this Jan 31, 2018
@GuusPunt
Copy link
Author

lineshowvalues_true

I have enabled the showValues value on the line series. Now the values of the line are drawn in the chart, but the line is not visible.

@rousan
Copy link

rousan commented Feb 1, 2018

Hi @GuusPunt,

Can you provide samples code to produce the same at our end?

@GuusPunt
Copy link
Author

GuusPunt commented Feb 2, 2018

Hi @rousan .

I'm quite new to github, in which form would be the best to provide the sample code?

PS:
The charts draw perfect when i start an timer in the angularjs controller init function instead of calling a service and setting the response instant to the datasource of the chart. My problems is kind of solved but im still wondering what causes the difference between the two differents approaches as shown below.

---- Line not drawn, bars drawn ----

function initController() {
        CashflowService.GetCurrentRateChart('2018')
        .then(function(result){
          if(result.success){
            vm.currentRateChart.dataset[0].data     = result.incoming;
            vm.currentRateChart.dataset[1].data     = result.outgoing;
            vm.currentRateChart.dataset[2].data     = result.cashisking;
          }
        });
    }

---- Perfectly working example ----

    function initController() {
        startUpdatingCharts();
    }

   var updateCharts;
   function startUpdatingCharts (){
    updateCharts = $interval(function() {
        updateCurrentRate();
    }, 1000);
   }

   $scope.stopUpdatingCharts = function() {
    if (angular.isDefined(updateCharts)) {
        $interval.cancel(updateCharts);
        updateCharts = undefined;
    }
   };

   $scope.$on('$destroy', function() {
    // Make sure that the interval is destroyed too
    $scope.stopUpdatingCharts();
   });

function updateCurrentRate(){
    console.log("updating current rate chart");
    CashflowService.GetCurrentRateChart('2018')
    .then(function(result){
      if(result.success){
        vm.currentRateChart.dataset[0].data     = result.incoming;
        vm.currentRateChart.dataset[1].data     = result.outgoing;
        vm.currentRateChart.dataset[2].data     = result.cashisking;
      }
    });
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants