MatusVrsansky

Experience

480

0 Best Reply Awards

  • Member Since 10 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

1st December, 2017

MatusVrsansky left a reply on Ajax Code In JavaScript Do Not Respond • 9 months ago

Tried this , but throuh jQuery.ajax I can not get to the my url... still do not know, why. I tried a lot of implementations, but nothing worked so far.

also I modified web.php route:

Route::get('/check_myinput', '[email protected]_input')->name('check_myinput');

MatusVrsansky started a new conversation Ajax Code In JavaScript Do Not Respond • 9 months ago

I implemented my chart through javascript function to my Laravel project, and I would like to exececute Controller after clicking of certain part. I implemented code according to several sources on the internet, but still does not work correctly... problem is, that route is not executed...someone know, where is the mistake, please?

javascript function in view:

<script>
var canvasP = document.getElementById("pieChart");

   var prirodne_vedy = {!! json_encode($count_prirodne_vedy) !!};
   var stredoeuropske_studie = {!! json_encode($count_stredoeuropske_studie) !!};
   var filozoficka_fakulta = {!! json_encode($count_filozoficka_fakulta)!!};
   var pedagogicka_fakulta = {!! json_encode($count_pedagogicka_fakulta)!!};
   var social_vedy_a_zdrav = {!! json_encode($count_socialne_vedy_a_zdrav)!!};

    

   var ctxP = canvasP.getContext('2d');
   var myPieChart = new Chart(ctxP, {
   type: 'pie',
   //tooltip: { pointFormat: '{data.labels}: <b>{point.percentage:.1f}%</b>'},
   
   title: { text: 'Mychart'},
   data: {
      labels: ["Fakulta prírodných Vied", "Fakulta stredoeurópskych Štúdií", "Filozofická fakulta", "Pedagogická fakulta", "Fakulta sociál.vied a zdravotníctva"],
      datasets: [{
         data: [prirodne_vedy, stredoeuropske_studie, filozoficka_fakulta, pedagogicka_fakulta, social_vedy_a_zdrav],
         backgroundColor: ["#2196F3", "#F44336", "#FFC107", "#8D7373", "#201A48"],
        // hoverBackgroundColor: ["#B2EBF2", "#FFCCBC", "#4DD0E1", "#FF8A65", "#00BCD4"]
      }]
   },
   options: {
      legend: {
        
        
         position: "right"
      }
   }
});

canvasP.onclick = function(e) {
   var slice = myPieChart.getElementAtEvent(e);
   if (!slice.length) return; // return if not clicked on slice
   var label = slice[0]._model.label;
   switch (label) {
      // add case for each label/slice
      case 'Fakulta prírodných Vied':
         //alert('clicked on slice 5');
       //  "{{ URL::to('zone') }}"

       jQuery.ajax({

        url:'check_myinput',
        type: 'GET',
        data: {

            name: 'My data sending to controller on comparing'

        },
        success: function( data ){

            console.log(data);
        }
       });
      
      //var url = "{{ route('stastistics-fpv')}}";
    // window.location.replace(url);
        break;
 }
}
</script>

route in web.php

Route::get('check_myinput', '[email protected]_input')->name('check_myinput');

in my ChartController


 public function check_input(Request $request)
    {
         $name = $request->input('name');

        if($name == "Fakulta prírodných Vied")
        {
              // execute something
        }

        else
        {
            
        }


    }

27th November, 2017

MatusVrsansky left a reply on Implemented Chart Do Not Show • 9 months ago

Unbelievable, it is working :) ,, great, finally, thanks so much,, and Can I ask you something else??? I am newbie in JavaScript, and need to finish my project to school.

I need to create something like '.percentage:.1f' on each Label of my chart, do you know, how to implement it, please??


var canvasP = document.getElementById("pieChart");
var ctxP = canvasP.getContext('2d');
var myPieChart = new Chart(ctxP, {
   type: 'pie',
   //tooltip: { pointFormat: '{data.labels}: <b>{point.percentage:.1f}%</b>'},
   
   title: { text: 'Mychart'},
   data: {
      labels: ["Fakulta prírodných Vied", "Fakulta stredoeurópskych Štúdií", "Filozofická fakulta", "Pedagogická fakulta", "Fakulta sociál.vied a zdravotníctva"],
      datasets: [{
         data: [45, 5, 10, 20, 52],
         backgroundColor: ["#64B5F6", "#FFD54F", "#2196F3", "#FFC107", "#1976D2"],
         hoverBackgroundColor: ["#B2EBF2", "#FFCCBC", "#4DD0E1", "#FF8A65", "#00BCD4"]
      }]
   },
   options: {
      legend: {
        
         position: "right"
      }
   }
});

MatusVrsansky started a new conversation Implemented Chart Do Not Show • 9 months ago

I try to implement chart to my project, according to example from the - https://stackoverflow.com/questions/45980436/chart-js-link-to-other-page-when-click-on-specific-section-in-chart/47506304?noredirect=1#comment81968297_47506304 , but my chart does not show... do I do something wrong, someone know, how to solve it, please??

my view:

<!DOCTYPE html>
<head>


</head>

<body>
<script>
var canvasP = document.getElementById("pieChart");
var ctxP = canvasP.getContext('2d');
var myPieChart = new Chart(ctxP, {
   type: 'pie',
   data: {
      labels: ["Värde 1", "Värde 2", "Värde 3", "Värde 4", "Värde 5", "Värde 6", "Värde 7"],
      datasets: [{
         data: [1, 5, 10, 20, 50, 70, 50],
         backgroundColor: ["#64B5F6", "#FFD54F", "#2196F3", "#FFC107", "#1976D2", "#FFA000", "#0D47A1"],
         hoverBackgroundColor: ["#B2EBF2", "#FFCCBC", "#4DD0E1", "#FF8A65", "#00BCD4", "#FF5722", "#0097A7"]
      }]
   },
   options: {
      legend: {
         display: true,
         position: "right"
      }
   }
});

canvasP.onclick = function(e) {
   var slice = myPieChart.getElementAtEvent(e);
   if (!slice.length) return; // return if not clicked on slice
   var label = slice[0]._model.label;
   switch (label) {
      // add case for each label/slice
      case 'Värde 5':
         alert('clicked on slice 5');
         window.open('www.example.com/foo');
         break;
      case 'Värde 6':
         alert('clicked on slice 6');
         window.open('www.example.com/bar');
         break;
      // add rests ...
   }
}
</script>



<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<canvas id="pieChart"></canvas>

</body>
</html>

26th November, 2017

MatusVrsansky left a reply on How To Refresh Same View And Change A Shape Of Chart With New Data After Clicking On Certain Part In The Chart?? • 9 months ago

I already found solution, on clicking certain lable, and after click will be showed details about clicked label, be but still does not work... tried to did something like example from this website: https://jsfiddle.net/u1szh96g/208/ , but my chart does not worked like example chart...

script :

<script>

$(document).ready(

function(){

        var mydiv = document.getElementById("mychart");

        mydiv.onclick = function(evt) {
        var activePoints = myNewChart.getElementsAtEvent(evt);
        if (activePoints[0]) {
        var chartData = activePoints[0]['_chart'].config.data;
        var idx = activePoints[0]['_index'];

        var label = chartData.labels[idx];
        var value = chartData.datasets[0].data[idx];

        var url = "http://example.com/?label=" + label + "&value=" + value;

        console.log(url);
        alert(url);
      }
  };       
}
);
</script>


in html:

<div class="mygraph>"

                {!! $charts->html() !!}

                <canvas id="mychart"></canvas>
</div>

and my graph is created in My controller :

$charts = Charts::create('pie', 'highcharts')
    ->title('Statistics')
    ->labels(['Fakulta prírodných Vied', 'Fakulta stredoeurópskych Štúdií', 'Filozofická fakulta', 'Pedagogická fakulta', 'Fakulta sociál.vied a zdravotníctva'])
    ->colors(['#2196F3', '#F44336', '#FFC107', '#8D7373', '#201A48'])
    ->values([$count_prirodne_vedy,$count_stredoeuropske_studie,$count_filozoficka_fakulta,$count_pedagogicka_fakulta, $count_socialne_vedy_a_zdrav])
    ->dimensions(1000,500)
    ->responsive(false);

        return view('chart', compact('charts'));

Did you meet with something like that sometimes, please??

MatusVrsansky started a new conversation How To Refresh Same View And Change A Shape Of Chart With New Data After Clicking On Certain Part In The Chart?? • 9 months ago

I would like to refresh view with my chart, but after refreshing need to change shape of chart, data, and etc ....(after clicking on chart/or part of chart) . There is also a solution to create new view, but I would like to code this purpose effective... someone know, how to do it, please???

mycode:

 $charts = Charts::create('pie', 'highcharts')
    ->title('Statistics')
    ->labels(['Faculty of Natural Sciences', 'Faculty of Central European Studies', ' faculty of phylosophy', 'Faculty of Education'])
    ->colors(['#2196F3', '#F44336', '#FFC107', '#8D7373', '#201A48'])
    ->values([$count_phyloshopy_facult,$count_central_studies,$count_natural_sciences,$count_p, $count_education])
    ->dimensions(1000,500)
    ->responsive(false);

        return view('chart', compact('charts'));
    }

24th November, 2017

MatusVrsansky left a reply on Why My Created Chart Is Not Showed In The View? • 9 months ago

Very interesting, that switched two lines can caused such a big problem, but thank you so much, next time I will know...

23rd November, 2017

MatusVrsansky left a reply on Why My Created Chart Is Not Showed In The View? • 9 months ago

sorry, mistake in uploading code:

my view:

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title> JS Bin</title>
 </head>
 <body>

    <canvas id="graph"></canvas>

    <script src="public/js/canvasjs.min.js"></script>
    <script type="text/javascript"
        
        src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js">


    </script>
 </body>
 </html>

my javascript file:


var data = {



    labels: ['January', 'February', 'March'],

    datasets: [
        {
            data: [30, 122, 90]
        }
    ]
}

var context = document.querySelector('#graph').getContext('2d');

new Chart(context).Line(data);

MatusVrsansky started a new conversation Why My Created Chart Is Not Showed In The View? • 9 months ago

I try to implement simple chart to my view with help of my javascript file... My code is executed, but my view is blank.... someone know, how to solve this problem, please?

code in my view:

´´´

JS Bin
<canvas id="graph"></canvas>

<script src="public/js/canvasjs.min.js"></script>
<script type="text/javascript"
    
    src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js">


</script>

´´´

code in my javascript file:

´´´

var data = {

labels: ['January', 'February', 'March'],

datasets: [
    {
        data: [30, 122, 90]
    }
]

}

var context = document.querySelector('#graph').getContext('2d');

new Chart(context).Line(data);

´´´

19th November, 2017

MatusVrsansky left a reply on How To Get Value From Textarea? • 10 months ago

Definitely will try it, but please, what means variable: {{ ucfirst($markers->description) }} ?

Is it like my $profile->consultation_hours variable in my view???

MatusVrsansky left a reply on How To Get Value From Textarea? • 10 months ago

view code:

<form class="form-horizontal" method="POST" action="{{route('insert_user_info')}}">                         
        <table class="table">
            <tr>
                <th><h4>Popis</h4></th>
                <td><textarea class="form-control" name="description" rows="7">{{ $profile->consultation_hours }}</textarea></td>
            </tr>
    </table>

web.php code

Route::post('insert_user_info', array(

    'as' => 'insert_user_info',

    function() {

   
      $info= Textarea::get('description');  


 }


));

sorry , my mistake. I am newbie on the laracasts

MatusVrsansky left a reply on How To Get Value From Textarea? • 10 months ago

Code in view: textarea class="form-control" name="description" rows="7">{{ $profile->consultation_hours }}

MatusVrsansky left a reply on How To Get Value From Textarea? • 10 months ago

I would like to get data from my textarea, and later save them to the variable in my web.php, but , the compiler says, that class Textarea is not defined...

Someone know, how to solve this problem?

{{ $profile->description}}

Code in my web.php

Route::post('insert_user_info', array(

'as' => 'insert_user_info',

function() {



  $info = Textarea::get('description');  

}

));

MatusVrsansky left a reply on How To Get Value From Textarea? • 10 months ago

Sorry, mistake in update ...I would like to get data from my textarea, and later save them to the variable in my web.php, but , the compiler says, that class Textarea is not defined...

Someone know, how to solve this problem?

Code in my view:

Description

{{ $profile->description}}

Code in my web.php

Route::post('insert_user_info', array(

'as' => 'insert_user_info',

function() {



  $info = Textarea::get('description');  

}

));

MatusVrsansky left a reply on How To Get Value From Textarea? • 10 months ago

I would like to get data from my textarea, and later save them to the variable in my web.php, but , the compiler says, that class Textarea is not defined...

Someone know, how to solve this problem?

Code in my view:

Description

{{ $profile->description}}

Code in my web.php

Route::post('insert_user_info', array(

'as' => 'insert_user_info',

function() {



  $info = Textarea::get('description');  

}

));

MatusVrsansky started a new conversation How To Get Value From Textarea? • 10 months ago

I would like to get data from my textarea, and later save them to the variable in my web.php, but , the compiler says, that class Textarea is not defined...

Someone know, how to solve this problem?

Code in my view:

Description

{{ $profile->description}}

Code in my web.php

Route::post('insert_user_info', array(

'as' => 'insert_user_info',

function() {



  $info = Textarea::get('description');  

11th November, 2017

MatusVrsansky left a reply on How To Verift Record From The Database According More Than One Input::get() Funciton • 10 months ago

Yes, that is corrected, I just did id, problem was in the name of the Input::get() function for Publisher, specifically I used 'Publisher' instead of 'publisher', not case sensitive :) Inattention, but finally it worked, thanks a lot for your help and effort :)

MatusVrsansky started a new conversation How To Verift Record From The Database According More Than One Input::get() Funciton • 10 months ago

I would like to search certain record from my database, but I need to set Route::post() function on reading two Input::get() functions, here is my code, and Idea how to do it please?

Route::post('searchPublication', array (

'as' => 'searchPublication',

function() {

  $ISBN = Input::get('isbn');
  $PUBLISHER = Input::get('Publisher');
  


  $user = DB::table('publications') ->select('ISBN', 'title', 'type', 'publisher')
  ->where('isbn', '=', $ISBN)->first();
  
  



 
    return view("testpublication_view", ['user' => $user]);

} ));

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.