d3.js如何获取坐标轴实际ticks值(实际刻度个数) 5C

我设置了ticks值为10

```var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.ticks(10);

但实际会根据数据的范围返回或多或少的刻度数量,并不是我设定的10,。我该如何获取实际的ticks值。

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
将D3.js与symfony2一起使用

<div class="post-text" itemprop="text"> <p>I just started learning php for a few weeks and now I'm using Symfony2 as a framework. So, I have very few knowledges using Symfony.</p> <p>What I'm trying to do now is, I want to implement this D3 <a href="http://www.d3noob.org/2013/02/using-mysql-database-as-source-of-data.html" rel="nofollow">tutorial</a> but rather than use plain php, I want to use Symfony.</p> <p>So, what I did until now :</p> <ol> <li>Created a database called 'homedb' and I fill it exactly as the tutorial did.</li> <li>Managed to connect symfony with the database (modified in parameters.yml)</li> <li>Created a new bundle call TreeBundle.</li> <li>Created a controller called DataController to fetch data from the database.</li> <li>Created a html.twig file to display the data.</li> </ol> <p>I converted this file : data.php </p> <pre><code>&lt;?php $username = "homedbuser"; $password = "homedbuser"; $host = "localhost"; $database="homedb"; $server = mysql_connect($host, $username, $password); $connection = mysql_select_db($database, $server); $myquery = "SELECT `date`, `close` FROM `data2`"; $query = mysql_query($myquery); if ( ! $query ) { echo mysql_error(); die; } $data = array(); for ($x = 0; $x &lt; mysql_num_rows($query); $x++) { $data[] = mysql_fetch_assoc($query); } echo json_encode($data); mysql_close($server); </code></pre> <p>into this file : <code>DataController.php</code></p> <pre><code>&lt;?php // src/Dependency/TreeBundle/Controller/DataController.php namespace TreeBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; class DataController extends Controller { /** * @Route("/tree") */ public function queryAction() { $em = $this-&gt;getDoctrine()-&gt;getEntityManager(); $query=$em-&gt;createQuery( 'SELECT date AND close FROM data2' ); $list = $query-&gt;getResult(); return new JsonResponse($list); } return $list-&gt;render('DependencyTreeBundle:Data:simple-graph.html.twig'); } </code></pre> <p>but, I got this error :</p> <pre><code>Parse Error: syntax error, unexpected 'return' (T_RETURN), expecting function (T_FUNCTION) </code></pre> <p>I know this is just a tiny error from my erroneous code. Anyone could help me to correctly converted this script?</p> <p>P/S : For my simple-graph.html.twig, I just use <code>{{source(simple-graph.html)}}</code> to just return the content without rendering it. </p> <p><strong>UPDATE 1</strong></p> <p><em>I just edited my code as follow to fetch the data from database and convert it to json.</em></p> <pre><code>public function queryAction() { $em = $this-&gt;getDoctrine()-&gt;getManager(); $sql = " SELECT date, close FROM data2 "; $stmt = $this-&gt;getDoctrine()-&gt;getManager()-&gt;getConnection()-&gt;prepare($sql); $stmt-&gt;execute(); return $stmt-&gt;fetchAll(); $json = json_encode($stmt); return $json--&gt;render('DependencyTreeBundle:query:simple-graph.html.twig'); } </code></pre> <p><em>But, I got this error this time</em> : <code>The controller must return a response (Array(0 =&gt; Array(date =&gt; 1-May-12, close =&gt; 58.13), 1 =&gt; Array(date =&gt; 30-Apr-12, close =&gt; 53.98), ,....</code></p> <p><em>Seems like the data is fetched but failed to convert it as json..</em></p> <p><strong>UPDATE 2</strong></p> <p>Here is my new code thanks to @adiii4 for the suggestion. But this code has error : <em>Attempted to load class "TreeBundle" from namespace "Dependency\TreeBundle". Did you forget a "use" statement for another namespace?</em></p> <pre><code>&lt;?php // src/Dependency/TreeBundle/Controller/DataController.php namespace Dependency\TreeBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; class DataController extends Controller { /** * @Route("/tree") */ public function queryAction() { $em = $this-&gt;getDoctrine()-&gt;getManager(); $sql = " SELECT date, close FROM data2 "; $stmt = $this-&gt;getDoctrine()-&gt;getManager()-&gt;getConnection()- &gt;prepare($sql); $stmt-&gt;execute(); $stmt-&gt;fetchAll(); $list = json_encode($stmt); return $this-&gt;render('DependencyTreeBundle:Data:simple-graph.html.twig', array('data' =&gt; $list)); } } </code></pre> <p><strong>UPDATE 3</strong></p> <p>I think I managed to fetch the data and convert to json correctly. Now, I need to visualized the data by calling D3 in the html file. Is it possible just to embed the html file in Twig and let Twig alone do the rest? Or do I need to convert all of it to Twig syntaxes?</p> <p>Here is the source code of the simple-graph.html :</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;meta charset="utf-8"&gt; &lt;style&gt; /* set the CSS */ body { font: 12px Arial;} path { stroke: steelblue; stroke-width: 2; fill: none; } .axis path, .axis line { fill: none; stroke: grey; stroke-width: 1; shape-rendering: crispEdges; } &lt;/style&gt; &lt;body&gt; &lt;!-- load the d3.js library --&gt; &lt;script src="http://d3js.org/d3.v3.min.js"&gt;&lt;/script&gt; &lt;script&gt; // Set the dimensions of the canvas / graph var margin = {top: 30, right: 20, bottom: 30, left: 50}, width = 600 - margin.left - margin.right, height = 270 - margin.top - margin.bottom; // Parse the date / time var parseDate = d3.time.format("%d-%b-%y").parse; // Set the ranges var x = d3.time.scale().range([0, width]); var y = d3.scale.linear().range([height, 0]); // Define the axes var xAxis = d3.svg.axis().scale(x) .orient("bottom").ticks(5); var yAxis = d3.svg.axis().scale(y) .orient("left").ticks(5); // Define the line var valueline = d3.svg.line() .x(function(d) { return x(d.date); }) .y(function(d) { return y(d.close); }); // Adds the svg canvas var svg = d3.select("body") .append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); // Get the data d3.json("data.php", function(error, data) { data.forEach(function(d) { d.date = parseDate(d.date); d.close = +d.close; }); // Scale the range of the data x.domain(d3.extent(data, function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.close; })]); // Add the valueline path. svg.append("path") .attr("class", "line") .attr("d", valueline(data)); // Add the X Axis svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis); // Add the Y Axis svg.append("g") .attr("class", "y axis") .call(yAxis); }); &lt;/script&gt; &lt;/body&gt; </code></pre> <p>What I did just now, in my simple-graph.html.twig is, I just outsource the json data, and call the html file to do the rest. Obviously, I was thrown with this error : <em>Unable to find template "{}" in DependencyTreeBundle:Data:simple-graph.html.twig at line 2</em></p> <p>Here is my code in my simple-graph.html.twig :</p> <pre><code>{# src/Dependency/TreeBundle/Resources/views/simple-graph.html.twig #} {{ source(data) }} {{ source('public/html/simple-graph.html') }} </code></pre> <p>Does anyone have idea? I appreciate it a lot. </p> </div>

加载配置文件时出错: 滴答数必须介于

昨天非正常关机,今天早上调试本地asp.net网站出现这个错误,昨天之前都是正常的,至少报的不是错误,网上找了下对着操作了一遍也不对,急,在线等。。 加载配置文件时出错: 滴答数必须介于 DateTime.MinValue.Ticks 和 DateTime.MaxValue.Ticks的错误,然后也没有显示具体错误行,最下面显示asp.net默认系统配置文件 C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config 0行。

用PHP获取时间刻度

<div class="post-text" itemprop="text"> <p>Consider this line of code in C# </p> <pre><code>ordernumber.Value = DateTime.Now.Ticks.ToString(); </code></pre> <p>How to get same <code>ordernumber.Value</code> in PHP</p> <pre><code>$ordernumberValue = microtime(); //? </code></pre> <p>I try to this </p> <p><code> echo microtime(true) * 10000000;</code></p> <p>But get result string.length was difference. short length than C#.</p> </div>

D3.js X,Y轴正常显示,但是折线显示不出来

var width = 1400, height = 200, margin = 30, g_width = width - margin - margin, g_height = height - margin - margin; var data = [ { x: "2017-11-30", y: 5 }, { x: "2018-12-30", y: 5 }, { x: "2018-1-30", y: 5 }, { x: "2018-2-30", y: 5 }, { x: "2018-3-30", y: 9 }, { x: "2018-4-30", y: 7 }, { x: "2018-5-30", y: 5 }, { x: "2019-6-30", y: 3 }, { x: "2018-7-30", y: 4 }, { x: "2018-8-30", y: 2 }, { x: "2018-9-30", y: 3 }, { x: "2020-10-3", y: 2 } ]; //X,Y比例尺 var datamax = d3.max(data, function (d: { x: any; }) { return d.x; }); var datamin = d3.min(data, function (d: { x: any; }) { return d.x; }); var xscale = d3.scaleBand() .domain([datamin, datamax]) .range([0, width]); var yscale = d3.scaleLinear() .domain([0, 30]) .range([height - 2 * margin, 0]); //svg var svg = d3.select("#container") //选择元素 .append("svg") //添加元素 .attr("width", width) //设置属性 .attr("height", height) .attr("transform", "translate(30,0)") // g var g = d3.select("svg") .append("g") .attr("transform", "translate(" + margin + "," + margin + ")") //X,Y轴 var x_axis = d3.axisBottom(xscale).ticks(12); var y_axis = d3.axisLeft(yscale); //g元素与X轴Y轴绑定 g.append("g") .call(x_axis) .attr("transform", "translate(0," + g_height + ")") g.append("g") .call(y_axis) .append("text") //添加轴标签 .text("price") //创建线生成器 var line = d3.line() .x(function (d: { x: any; }) { return xscale(d.x); }) .y(function (d: { y: any; }) { return yscale(d.y); }) .curve(d3.curveLinear); //绘制折线 svg.selectAll("path.line") .data(data) .enter() .append("path") .attr("class", "line"); svg.selectAll("path.line") .data(data) .attr("d", function (d: any) { return line(d); }); //连接圆圈 data.forEach(function (list) { svg.append("g") .selectAll("circle") .data(list) .enter() .append("circle") .attr("class", "dot") .attr("cx", function (d: { x: any; }) { return xscale(d.x); }) .attr("cy", function (d: { y: any; }) { return yscale(d.y); }) .attr("r", 4.5) }); ![图片说明](https://img-ask.csdn.net/upload/202003/23/1584948463_45785.jpg) X,Y轴正常显示,但是折线显示不出来 ![图片说明](https://img-ask.csdn.net/upload/202003/23/1584949530_912214.jpg)

将鼠标悬停在折线图上会显示chart.js中的旧图表数据问题

<div class="post-text" itemprop="text"> <p>I have a line graph with using <code>chart.js</code>. Here I have 3 options for showing their data: All time, 3 Months, 1 months. which are working fine. but the issue is the, whenever user select 1 month or 3-month data graph and hover the mouse cursor over graph lines then it shows old data(All time). </p> <p><strong>Expected outcome:</strong> Chart no longer has any trace of original data, but instead, shows new data and user can interact with it without issues.</p> <p><strong>Actual outcome:</strong> Chart shows new data, but if a user hovers over the chart, it'll flicker back and forth between original and new data.</p> <p><strong>Here is my code:</strong></p> <pre><code> $.ajax({ url: "some_url_here, method: "GET", success: function(data) { var month = []; var customers = []; var data = JSON.parse(data); var margin = []; for(var i in data) { month.push( data[i].time); customers.push(data[i].profit); margin.push(data[i].exchnage); } var chartdata1 = { labels: month, datasets : [ { label: 'monthly customers for Year 2016', backgroundColor: 'rgba(255, 99, 132, 0.5)', borderColor: 'rgb(255, 99, 132)', data: customers, lineTension: 0 } ] }; var frame = $("#"+currcanvas); var aR = null; //store already returned tick var ctx = document.getElementById(currcanvas).getContext('2d'); var barGraph1 = new Chart(frame, { type: 'line', data: chartdata1, options: { scales: { xAxes: [{ ticks: { autoSkip: false, callback: function(e) { if(e.match(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec).*?\d+/g)!=null){ var tick = e.match(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec).*?\d+/g)[0]; if (tick != aR) { aR = tick; return tick; } } } } }] }, responsive: true, tooltips: { /* bodyFontColor: "#000000",fontColor: "#000000", //#000000 borderColor: 'rgba(255, 99, 132, 0.5)', backgroundColor: '#EEEEEE',*/ callbacks: { afterBody: function(t, d) { return 'current profit/loss: ' + margin[t[0].index]; } } } } }); } }); </code></pre> <p>So please guide me. where I am going wrong or is there any way to fix this issue. Thanks</p> </div>

jfreechart 柱图x坐标轴标签太密集,标签重叠了

JFreeChart chart = ChartFactory.createStackedBarChart3D("","","",dataset_bar,PlotOrientation.VERTICAL,true,true,false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); CategoryAxis categoryaxis = plot.getDomainAxis(); categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); categoryaxis.setMaximumCategoryLabelWidthRatio(5.0f); categoryaxis.setMaximumCategoryLabelLines(1); categoryaxis.setTickLabelsVisible(false); chart.setBackgroundImageAlpha(0.01F); categoryaxis.setTickMarksVisible(true); categoryaxis.setCategoryLabelPositionOffset(20); return chart; [img]http://dl.iteye.com/upload/attachment/384493/fac87842-a6df-3c6a-b486-e6a954c480f9.jpg[/img] 很急很急。。若能给出其他解决方案也好!

如何使用Chart.js阅读和绘制json

<div class="post-text" itemprop="text"> <p>I have an html file like this:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min.js"&gt;&lt;/script&gt; &lt;script src="https://code.jquery.com/jquery-3.1.0.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;canvas id="myChart" width="400" height="400"&gt;&lt;/canvas&gt; &lt;script&gt; function drawChart() { console.log("start"); $.getJSON("test.json", function (data) { console.log("loaded"); var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: data, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); }).fail(function(){ console.log("fail") }); } drawChart() &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>... and a json file like this:</p> <pre><code>{ labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [20, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] } </code></pre> <p>... and the json load always fails. I tried several methods to read json and draw chart with Chart.js, but always failed.</p> <p>I tried to plot the json with php without success:</p> <pre><code>&lt;?php header("Content-Type: application/json"); $filename = "test.json"; $fp = fopen($filename, "r"); $content = fread($fp, filesize($filename)); explode(" ", $content); fclose($fp); print_r($content); ?&gt; </code></pre> <p>What's wrong with this?</p> </div>

雷达图(chart.js 2.5.0)使用数据库值创建第二层

<div class="post-text" itemprop="text"> <p>I'm using Chartjs to create a radar chart to show scores of modules. It is working for 1 module however when I enter a 2nd module the data is placed in the same dataset causing the labels to double. The value points are also not changing name keeping the first modules point label but having different values.</p> <p>This is the function used to create the graph, if the data is undefined it creates a chart but if not it adds the data to the dataset.</p> <pre><code>&lt;script src=//code.jquery.com/jquery-3.2.1.min.js&gt;&lt;/script&gt; &lt;script src=https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.bundle.js&gt;&lt;/script&gt; &lt;input id=MOD_CODE value=SET08108&gt;&lt;button id='go'&gt;Go&lt;/button&gt; &lt;canvas id="myChart" width="300" height="300"&gt;&lt;/canvas&gt; &lt;script&gt; var data; $(function(){ $('#go').click(function(){ $.ajax({url:'output.php', data {MOD_CODE:$('#MOD_CODE').val()},dataType:'json', success:function(d){ if(data===undefined) data = {labels:[],datasets:[{label:$('#MOD_CODE').val()+' Results',data:[],}]}; else { data.datasets.push({label:$('#MOD_CODE').val()+' Results',data:[],}); } for(var i=0;i&lt;d.length;i++){ data.labels.push(d[i][0]); data.datasets[0].data.push(parseFloat(d[i][1])); } var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'radar', data:data, options:{ responsive:false, scale:{ticks:{beginAtZero: true}}}}); }}); }) }); &lt;/script&gt; </code></pre> <p>This is the the php file which gets the data based on the module code from the database, it also converts to json format for the dataset.</p> <pre><code>&lt;?php if(!array_key_exists('MOD_CODE',$_REQUEST)){ print "&lt;form&gt;&lt;input name=MOD_CODE&gt;&lt;/form&gt;"; exit(); } $con = new mysqli(''); if (mysqli_connect_errno()) { printf("Connection failed: %s ", mysqli_connect_error()); exit(); } $sql = " SELECT QUE_CODE, 100*AVG(CASE WHEN RES_VALU IN (4,5) THEN 1 ELSE 0 END) AS v FROM INS_RES WHERE MOD_CODE = ? GROUP BY QUE_CODE ORDER BY QUE_CODE "; $stmt = $con-&gt;prepare($sql) or die($con-&gt;error); $stmt-&gt;bind_param('s',$_REQUEST['MOD_CODE']) or die('Bind error'); $stmt-&gt;execute(); $res = $stmt-&gt;get_result() or die('get_result failed: '.$con-&gt;error); print json_encode($res-&gt;fetch_all()); </code></pre> </div>

jpgraph x轴刻度

<div class="post-text" itemprop="text"> <p>how can i tell jpgraph to show x-axis ticks every month? I have two charts, in one i show results from 1 year and on other i show results from beginning to end. On year graph it shows weekly results and i like it but in case of showing bigger date range (in my case from 1.4.2010. till 10.1.2013. it show tick only every one year so i have tick on 1.4.2010, 1.4.2011, ...</p> <p>Important part of the code where i define x-axis properties:</p> <pre><code>$graph-&gt;xaxis-&gt;SetTickLabels($timestamp); $graph-&gt;xaxis-&gt;scale-&gt;SetDateAlign(MONTHADJ_1); $graph-&gt;xaxis-&gt;SetFont(FF_ARIAL,FS_NORMAL,8); $graph-&gt;xaxis-&gt;SetLabelAngle(-45); $graph-&gt;xaxis-&gt;SetLabelMargin(2); $graph-&gt;xaxis-&gt;SetLabelAlign('left','top'); $graph-&gt;xaxis-&gt;SetLabelFormatString('d.m.Y',true); $graph-&gt;xaxis-&gt;HideFirstLastLabel(); </code></pre> <p>Timestamp array is unix timestamp values converted from mysql dates,and timestamps are correct. I checked them. Also results in the graphs are fine, only i want more ticks on x axis. </p> </div>

shell脚本怎么调用python的return值

我在python下写了一个比较字符串的python函数如下: import time if __name__ == "__main__": fo = open("steps.txt", "r+") steps = fo.read() print "读取的step是 : ", steps fo.close() T0 = 0 X = 600 ticks = time.time() T = (long(ticks) - T0) / X step = str(T).upper() while len(step) < 16: step = "0" + step def compare(): if steps == step: return 1 else: return 0 compare() 然后我想在shell脚本里调用这个compare.py获取函数return的值 代码如下: #!/bin/bash var1=`python compare.py` echo $var1 $var1并没有输出我想看到的return值1或0,而是执行了整个py文件 我只想接受这个return值有什么好的方法吗

Leaflet中的chart.js动态图表

<div class="post-text" itemprop="text"> <p>I have a script with charts and a leaflet map. The charts will adapt if you click the buttons. I also have a script to get the features. My question; how to adapt the charts by pressing a certain area (Now you get the features) on the map? So area on the map needs to replace the buttons. Area's called: Zuid-Holland , or Zeeland. Anyone idea? This is btw my first ever programming experience ;). So maybe the script is a little bit weird.</p> <p>The charts, with leaflet map script:</p> <pre><code>&lt;?php //Database connection include 'connection.php'; //Data insert include 'data.php'; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;link rel="stylesheet" type="text/css" href="mijnopmaak.css"&gt; &lt;link rel="stylesheet" href="Leaflet/leaflet.css" /&gt; &lt;style&gt; #mapid { position: absolute; top:50%; right:0; bottom:0; left:0; } &lt;/style&gt; &lt;title&gt;112 Meldingen&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1 style="color:green" align="center"&gt;112 Meldingen januari in Zeeland en Zuid-Holland&lt;/h1&gt; &lt;div id="mapid"&gt;&lt;/div&gt; &lt;!-- Plaatsen Donut --&gt; &lt;div style="width: 20%; height: 300px; display: inline-block; left: 550px;"&gt; &lt;canvas id="graph" &gt;&lt;/canvas&gt; &lt;!-- Plaatsen buttons --&gt; &lt;button class="button button2" id="btn1" &gt; Zeeland &lt;/button&gt; &lt;button class="button3 button4" id="btn2"&gt; Zuid-Holland &lt;/button&gt; &lt;!-- jQuery cdn --&gt; &lt;script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="crossorigin="anonymous"&gt;&lt;/script&gt; &lt;!-- Chart.js cdn --&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"&gt;&lt;/script&gt; &lt;script src="Leaflet/leaflet.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt; &lt;!-- Get the features --&gt; &lt;script src="L.TileLayer.BetterWMS.js"&gt;&lt;/script&gt; &lt;!-- Data to variables --&gt; &lt;?php include 'variables.php';?&gt; &lt;script&gt; var url = 'https://geodata.nationaalgeoregister.nl/cbsprovincies/wms'; var map = L.map('mapid').setView([52.1561113, 5.3878266], 8); L.tileLayer.betterWms(url, { layers: 'cbsprovincies2012', transparent: true, format: 'image/png' }).addTo(map); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '&amp;copy; &lt;a href="https://www.openstreetmap.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors' }).addTo(map); &lt;/script&gt; &lt;script&gt; // De donut var context = document.querySelector('#graph').getContext('2d'); if (window.bar !=undefined) window.bar.destroy(); window.bar = new Chart(context, { options: { title: { display: true, text: 'Meldingen per voertuig in Zuid-Holland' }}, type: "doughnut", data: donut_zeeland, }) ; //Reactie button1 donut $("#btn1").on("click", function() { var context1 = document.querySelector('#graph').getContext('2d'); if (window.bar !=undefined) window.bar.destroy(); window.bar = new Chart(context1, { type: "doughnut", data: donut_zeeland, options: { title: { display: true, text: 'Meldingen per voertuig in Zeeland' }}})}); //Reactie button2 donut $("#btn2").on("click", function() { var context2 = document.querySelector('#graph').getContext('2d'); if (window.bar !=undefined) window.bar.destroy(); window.bar = new Chart(context2, { type: "doughnut", data: donut_zuid, options: { title: { display: true, text: 'Meldingen per voertuig in Zuid-Holland' }}})}); &lt;/script&gt; &lt;!-- Plaatsen Lijn --&gt; &lt;div style="width: 35%; height: 300px;display: inline-block; position: absolute; left: 750px; top: 150px;" &gt; &lt;canvas id="Chart1" &gt;&lt;/canvas&gt; &lt;/div&gt; &lt;script&gt; //De lijn var context3 = document.querySelector('#Chart1').getContext('2d'); if (window.line !=undefined) window.line.destroy(); window.line = new Chart(context3, { type: "line", data: zeeland_line, options:{ title: { display: true, text: ['Meldingen in januari'] }, legend: { display: false, position: 'left', labels: { fontColor: 'black' } }, tooltips: { mode: 'nearest', displayColors:false, callbacks: { label: function(tooltipItem) { return tooltipItem.yLabel;}}}, scales: { yAxes: [{ ticks: { beginAtZero: false } }], xAxes: [{ ticks: { autoskip: false, } }] } }, }) ; $("#btn1").on("click", function() { var context3 = document.querySelector('#Chart1').getContext('2d'); if (window.line !=undefined) window.line.destroy(); window.line = new Chart(context3, { type: "line", data: zeeland_line, options: { legend: { display: false, position: 'left', labels: { fontColor: 'black' } }, title: { display: true, text: 'Meldingen in januari' } } } ) }); $("#btn2").on("click", function() { var context4 = document.querySelector('#Chart1').getContext('2d'); if (window.line !=undefined) window.line.destroy(); window.line = new Chart(context4, { type: "line", data: zuid_line, options: { legend: { display: false, position: 'left', labels: { fontColor: 'black' } }, title: { display: true, text: 'Meldingen in januari' } } }) }); &lt;/script&gt; </code></pre> <p>The get features script:</p> <pre><code>L.TileLayer.BetterWMS = L.TileLayer.WMS.extend({ onAdd: function (map) { // Triggered when the layer is added to a map. // Register a click listener, then do all the upstream WMS things L.TileLayer.WMS.prototype.onAdd.call(this, map); map.on('click', this.getFeatureInfo, this); }, onRemove: function (map) { // Triggered when the layer is removed from a map. // Unregister a click listener, then do all the upstream WMS things L.TileLayer.WMS.prototype.onRemove.call(this, map); map.off('click', this.getFeatureInfo, this); }, getFeatureInfo: function (evt) { // Make an AJAX request to the server and hope for the best var url = this.getFeatureInfoUrl(evt.latlng), showResults = L.Util.bind(this.showGetFeatureInfo, this); $.ajax({ url: url, success: function (data, status, xhr) { var err = typeof data === 'string' ? null : data; showResults(err, evt.latlng, data); }, error: function (xhr, status, error) { showResults(error); } }); }, getFeatureInfoUrl: function (latlng) { // Construct a GetFeatureInfo request URL given a point var point = this._map.latLngToContainerPoint(latlng, this._map.getZoom()), size = this._map.getSize(), params = { request: 'GetFeatureInfo', service: 'WMS', srs: 'EPSG:4326', styles: this.wmsParams.styles, transparent: this.wmsParams.transparent, version: this.wmsParams.version, format: this.wmsParams.format, bbox: this._map.getBounds().toBBoxString(), height: size.y, width: size.x, layers: this.wmsParams.layers, query_layers: this.wmsParams.layers, info_format: 'text/html' }; params[params.version === '1.3.0' ? 'i' : 'x'] = point.x; params[params.version === '1.3.0' ? 'j' : 'y'] = point.y; return this._url + L.Util.getParamString(params, this._url, true); }, showGetFeatureInfo: function (err, latlng, content) { if (err) { console.log(err); return; } // do nothing if there's an error // Otherwise show the content in a popup, or something. L.popup({ maxWidth: 800}) .setLatLng(latlng) .setContent(content) .openOn(this._map); } }); L.tileLayer.betterWms = function (url, options) { return new L.TileLayer.BetterWMS(url, options); }; </code></pre> </div>

D3JS没有在WAMP上工作

<div class="post-text" itemprop="text"> <p>EDIT 2: I found <a href="http://apc.andypotter.org/2011/03/23/apache-server-and-svg-graphics/" rel="nofollow">this article</a> and created a .htaccess file in the root dir of my site in wamp with the following two lines:</p> <pre><code>AddType image/svg+xml svg svgz AddEncoding gzip svgz </code></pre> <p>But still no errors and no charts. Could it be a WAMP set up issue? As I said this code works on my online site...</p> <hr> <p>EDIT: I placed an "alert(d.max_energy)" in the code and I can see the JSON values returning to the client page. It just does not get processed into a chart nor complain with an error.</p> <hr> <p>I am sure this is a simple fix but I cannot see it. I have the following code on a hosted site which works OK, and have now replicated in WAMP local server (a different machine in my network from the development PC), but does not execute / cause an error in Console / Inspect.</p> <p>Any help is appreciated.</p> <pre><code>&lt;script src="http://d3js.org/d3.v3.min.js" charset="utf-8"&gt;&lt;/script&gt; &lt;script&gt; jQuery( document ).ready(function() { CreateBarChart( "http://10.0.0.13/sma/sma-php/inverterdata.php?var=PDAY&amp;id=P100023", "#daychart" ); CreateBarChart( "http://10.0.0.13/sma/sma-php/inverterdata.php?var=PWEEK&amp;id=P100023", "#weekchart" ); CreateBarChart( "http://10.0.0.13/sma/sma-php/inverterdata.php?var=PMONTH&amp;id=P100023", "#monthchart" ); CreateBarChart( "http://10.0.0.13/sma/sma-php/inverterdata.php?var=PYEAR&amp;id=P100023", "#yearchart" ); CreateBarChart( "http://10.0.0.13/sma/sma-php/inverterdata.php?var=PLIFE&amp;id=P100023", "#lifechart" ); }); function CreateBarChart(url, divid) { var margin = {top: 20, right: 0, bottom: 30, left: 30}, width = 838 - margin.left - margin.right, height = 300 - margin.top - margin.bottom; var x = d3.scale.ordinal() .rangeRoundBands([0, width], .1); var y = d3.scale.linear() .range([height, 0]); var xAxis = d3.svg.axis() .scale(x) .orient("bottom"); var yAxis = d3.svg.axis() .scale(y) .orient("left") .ticks(10); var svg = d3.select(divid) .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); d3.json(url, function(error, data) { data.forEach(function(d) { d.max_energy = +d.max_energy; }); x.domain(data.map(function(d) { return d.xaxis; })); y.domain([0, d3.max(data, function(d) { return d.max_energy ; })]); svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) .append("text") .attr("transform", "rotate(0)") .attr("y", 23) .attr("x", 340) .attr("dy", ".71em") .style("text-anchor", "bottom") .text("Time / Date / Month / Year"); svg.append("g") .attr("class", "y axis") .call(yAxis) .append("text") .attr("transform", "rotate(0)") .attr("y", -15) .attr("x", -25) .attr("dy", ".71em") .style("text-anchor", "top") .text("Energy - KWh"); svg.selectAll(".bar") .data(data) .enter().append("rect") .attr("class", "bar") .attr("x", function(d) { return x(d.xaxis); }) .attr("width", x.rangeBand()) .attr("y", function(d) { return y(d.max_energy); }) .transition().delay(function (d,i){ return i * 10;}).duration(10) .attr("height", function(d) { return height - y(d.max_energy); }) svg.selectAll(".label") .data(data) .enter().append("svg:text") .attr("class", "label") .attr("x", function(d) { return x(d[d.xaxis]) + x.rangeBand() / 3; }) .attr("y", function(d) { return y(d[d.max_energy]) - 5; }) .text(function(d) { return y(d[d.max_energy]); });; }); }; &lt;/script&gt; </code></pre> <p>in the inverterdata.php file I have the following code:</p> <pre><code>&lt;?php $param = $_GET["var"]; $id = $_GET["id"]; $username = "root"; $password = ""; $host = "localhost"; $database="sma"; $server = mysql_connect($host, $username, $password); $connection = mysql_select_db($database, $server); switch ($param) { case "CDAY": $myquery = "SELECT poll_hour as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE customer_code = '".$id."' AND poll_day = DAY(DATE(NOW())) AND poll_month = MONTH(DATE(NOW())) AND poll_year = YEAR(DATE(NOW())) GROUP BY xaxis ORDER BY xaxis"; break; case "CWEEK": $myquery = "SELECT CONCAT(LPAD(poll_month, 2, '0'), LPAD(poll_day, 2, '0')) as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE customer_code = '".$id."' AND poll_year = YEAR(NOW()) AND poll_month = MONTH(NOW()) AND poll_day &gt; DAY(NOW()) - 8 GROUP BY xaxis ORDER BY xaxis"; break; case "CMONTH": $myquery = "SELECT CONCAT(LPAD(poll_month, 2, '0'), LPAD(poll_day, 2, '0')) as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE customer_code = '".$id."' AND poll_year = YEAR(NOW()) AND poll_month = MONTH(NOW()) GROUP BY xaxis ORDER BY xaxis"; break; case "CYEAR": $myquery = "SELECT CONCAT(poll_year, LPAD(poll_month, 2, '0')) as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE customer_code = '".$id."' AND poll_year = YEAR(NOW()) GROUP BY xaxis ORDER BY xaxis"; break; case "CLIFE": $myquery = "SELECT poll_year as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE customer_code = '".$id."' GROUP BY xaxis ORDER BY xaxis"; break; case "PDAY": $myquery = "SELECT poll_hour as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE partner_code = '".$id."' AND poll_day = '28' AND poll_month = '12' AND poll_year = '2013' GROUP BY xaxis ORDER BY xaxis"; break; case "PWEEK": $myquery = "SELECT CONCAT(LPAD(poll_month, 2, '0'), LPAD(poll_day, 2, '0')) as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE partner_code = '".$id."' AND poll_year = '2013' AND poll_month = '12' AND poll_day &gt; '21' GROUP BY xaxis ORDER BY xaxis"; break; case "PMONTH": $myquery = "SELECT CONCAT(LPAD(poll_month, 2, '0'), LPAD(poll_day, 2, '0')) as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE partner_code = '".$id."' AND poll_year = '2013' AND poll_month = '12' GROUP BY xaxis ORDER BY xaxis"; break; case "PYEAR": $myquery = "SELECT CONCAT(poll_year, LPAD(poll_month, 2, '0')) as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE partner_code = '".$id."' AND poll_year = '2013' GROUP BY xaxis ORDER BY xaxis"; break; case "PLIFE": $myquery = "SELECT poll_year as xaxis, SUM(energy) as max_energy, SUM(efficiency) as max_efficiency FROM sma_inverter_data WHERE partner_code = '".$id."' GROUP BY xaxis ORDER BY xaxis"; break; } $query = mysql_query($myquery); if ( ! $query ) { echo mysql_error(); die; } $data = array(); for ($x = 0; $x &lt; mysql_num_rows($query); $x++) { $data[] = mysql_fetch_assoc($query); } echo json_encode($data); mysql_free_result($query); mysql_close($server); ?&gt; </code></pre> <p>When I execute manually via browser address bar one of the PHP script calls I get back valid JSON as follows:</p> <pre><code>http://10.0.0.13/sma/sma-php/inverterdata.php?var=PLIFE&amp;id=P100023 </code></pre> <p>JSON:</p> <pre><code>[{"xaxis":"2012","max_energy":"305923.303","max_efficiency":"13019.572"},{"xaxis":"2013","max_energy":"410400.643","max_efficiency":"17466.284"},{"xaxis":"2014","max_energy":"4538.187","max_efficiency":"193.140"}] </code></pre> <p>My HTML inside the tag is:</p> <pre><code>&lt;svg id="daychart"&gt;&lt;/svg&gt; &lt;svg id="weekchart"&gt;&lt;/svg&gt; &lt;svg id="monthchart"&gt;&lt;/svg&gt; &lt;svg id="yearchart"&gt;&lt;/svg&gt; &lt;svg id="lifechart"&gt;&lt;/svg&gt; </code></pre> <p>Thanks</p> </div>

chart.js 数据很多想实现缩放功能,该怎么做啊?求大佬指路

如题,目前是这样的↓ ``` // line chart init var myLineChart = new Chart(lineChart, { type: 'line', data: lineData, options: { legend: { display: false }, scales: { xAxes: [{ ticks: { fontSize: '11', fontColor: '#969da5' }, gridLines: { color: 'rgba(0,0,0,0.05)', zeroLineColor: 'rgba(0,0,0,0.05)' } }], yAxes: [{ display: false, ticks: { beginAtZero: true, max: 65 } }] } } }); ```

做ajax请求时callback函数调用时this变量的变化问题

代码大致如下 [code="javascript"] var a = (function(){ var a = function (...,param) { return new a.fn.init (...,param) } a.fn = a.prototype = { init: function (...) { ... this.param = param } callback: function (response) { this.param //这里似乎this发生改变,this.param值为undefined ... } getData: function() { //通过ajax获得数据,然后回调 callback doGetAjax(url,data,this.callback) } } a.fn.init.prototype = a.fn; })() [/code] 像这种地方想要在callback获得param应该怎么做? edit1 -------------------------------------- 想了一下,这里ajax返回调用的时候this已经没有绑定了,在a内找不到再次与this绑定的方法, 那就不使用this,使用函数类的局部全局变量达到私有变量的效果, 代码改变如下 :[code="javascript"] var a = (function(){ var pParam; //添加私有变量 ... init: function (...) { ... pParam=this.param = param } ... callback: function (response) { pParam //这里似乎this发生改变,this.param值为undefined ... } [/code] 想了一下,是否所有对象的属性都应该赋值给 私有变量,而 this.XXX则是要暴露给外界才多加一个赋值? edit 2 ------------------------- 这两天重新看了下,发现这种私有变量是所有实例共享的,一个页面有多个同类组件的话就不行了. 如果是存储一个共享私有变量,每次ajax请求以后都手动立刻将私有变量赋值给相应实例变量,但这样的缺点是多次自动进行ajax操作的话是实现不了的,比如分页ajax请求。 这种情况究竟咋解决.

js中charts中怎么设置在柱状图上方显示对应的数值?

chart中我想在柱状图的上方显示对应的数值 我在label中设置了显示,但是图形上方还是没有数据, ``` itemStyle: { normal: { label: { show: true, //开启显示 position: 'top', //在上方显示 textStyle: { //数值样式 color: '#fff', fontSize: 16 ``` 后面我尝试加入上方的代码到下示代码后,依旧没有数值,这是咋回事 ``` var M = $.plot($("#chongyapinfen"), [{ data: L }], { series: { bars: { show: true, lineWidth: 20, fill: false, label: { normal: { show: true, position: 'top', textStyle: { color: 'red' } } }, }, points: { show: true, lineWidth: 3, fill: true, fillColor: "#fff" }, shadowSize: 0 }, grid: { hoverable: true, clickable: true, tickColor: "#aaa", borderColor: false }, colors: ["blue"], xaxis: { mode: "time", tickFormatter: function (Q, P) { return i[new Date(Q).getDay()]; }, color: "#222", autoscaleMargin: 1e-18 }, yaxis: { ticks: 4, tickDecimals: 0, color: "#222" } }); ```

chartjs的多个气泡图数据集

<div class="post-text" itemprop="text"> <p>I have an array called <code>main_arr</code> which has multiple data arrays within it.</p> <p>So i am using a <code>bubble chart</code> to show all these different arrays in different colors to distinguish them</p> <pre><code>var myBubbleChart = new Chart(ctx, { type : 'bubble', data : { datasets : [ { label : 'Group 1: ' + main_arr[0].length, data : main_arr[0], backgroundColor : 'lightblue' }, { label : 'Group 2: ' + main_arr[1].length, data : main_arr[1], backgroundColor : 'pink' } ], }, options : { scales : { yAxes : [{ ticks : { beginAtZero : true, min : 0, max : 100 } } ], xAxes : [{ ticks : { beginAtZero : true, min : 0, max : 10 } } ], } } }); </code></pre> <p>This works perfectly. But i want to make it dynamic so that i dont need to hard code <code>main_arr[0]</code>, <code>main_arr[1]</code>...so on for each array.</p> <p>So i want to use a for loop that loops through the <code>main_arr</code> and initialize the dataset.</p> <pre><code>datasets : [ for (var i = 0; i &lt; main_arr.length; i++) { { label : 'Group ' + i + ': ' + main_arr[i].length, data : main_arr[i], backgroundColor : 'lightblue' } } ], </code></pre> <p>This gives an error in the console: </p> <pre><code>Uncaught SyntaxError: Unexpected token for </code></pre> <p>So how to achieve this ?</p> </div>

执行:查找较低的时间值

<div class="post-text" itemprop="text"> <p>I'm using C# my entire life and now trying out GO. How do I find the lower time value between two time structs?</p> <pre><code>import ( t "time" "fmt" ) func findTime() { timeA, err := t.Parse("01022006", "08112016") timeB, err := t.Parse("01022006", "08152016") Math.Min(timeA.Ticks, timeB.Ticks) // This is C# code but I'm looking for something similar in GO } </code></pre> </div>

如果我声明(ticks = 1)但没有注册tick函数,那么产生的tick处理会产生什么样的开销呢?

<div class="post-text" itemprop="text"> <p>First of all - there seem to be many questions about the fundamentals of tick functionality, so I want to add <a href="http://php.net/manual/en/control-structures.declare.php#100137" rel="nofollow noreferrer">the top user comment at php.net/declare</a> to the pile for anyone looking for further information. I found it while digging around as I tried to figure out the following.</p> <hr> <p>So, I'm working on writing a simple debug helper. I want to add function tracing and benchmarking - basically what tick functionality is perfect for.</p> <p>Thing is, I want to enable and disable benchmarking depending on arbitrary conditions that occur during script processing. I'm not really looking for fixed debugging à la scoped <code>declare() { ... }</code>.</p> <p>What I'm looking to do is to put <code>declare();</code> at the top of my script, and then register and unregister my debugging/benchmarking (tick) function as appropriate. Un/registration won't happen (too) often, so is efficient and reasonable.</p> <p>But then I got curious: when I don't have a tick function registered... does the fact that I've run <code>declare(ticks=1);</code> have any effect on execution efficiency? Does it cause any extra processing to become permanently enabled anyway?</p> <p>Analysis of PHP(7)'s source code shows that the answer is technically <em>yes</em>, but I'm not yet sure <em>how</em>.</p> <p>The answer seems to be in <a href="https://github.com/php/php-src/blob/d3fa900780994ae812b5314900556a7f1bfb916e/Zend/zend_compile.c#L8200" rel="nofollow noreferrer">zend_compile.c:8200</a>: it appears this function defers compilation processing to the appropriate routines, then if ticks are enabled it additionally emits a <code>ZEND_TICKS</code> opcode into the opline via <code>zend_emit_tick()</code> in <a href="https://github.com/php/php-src/blob/d3fa900780994ae812b5314900556a7f1bfb916e/Zend/zend_compile.c#L2167" rel="nofollow noreferrer">:2167</a>. The <a href="http://php.net/manual/en/internals2.opcodes.ticks.php" rel="nofollow noreferrer">opcode reference page for TICKS</a> seems consistent with this conclusion; it shows an example disassembled opcode listing which has TICKS opcodes scattered throughout it, and I was wondering how they got in there until I discovered the above. </p> <p>The <code>ZEND_TICKS</code> handler (in <a href="https://github.com/php/php-src/blob/d56a534acc52b0bb7d61ac7c3386ab96e8ca4a97/Zend/zend_vm_def.h#L6859" rel="nofollow noreferrer">zend_vm_def.h:6859</a>) seems to call <code>zend_ticks_function()</code>. This is mapped to <code>ticks_function()</code> in <a href="https://github.com/php/php-src/blob/974a8f8ad2a0ed923abb5c63cfc7d73e2c81e21f/Zend/zend.c#L754" rel="nofollow noreferrer">zend.c:754</a>, which is in turn mapped to <code>php_run_ticks()</code> in <a href="https://github.com/php/php-src/blob/d92a701a3bb99fe8dbaa341589c2fc1e5010a6b8/main/main.c#L2013" rel="nofollow noreferrer">main.2013</a>. <em>This</em> is finally defined in <a href="https://github.com/php/php-src/blob/c8aa6f3a9a3d2c114d0c5e0c9fdd0a465dbb54a5/main/php_ticks.c" rel="nofollow noreferrer">php_ticks.c</a>, where it's all of:</p> <pre><code>void php_run_ticks(int count) { zend_llist_apply_with_argument( &amp;PG(tick_functions), (llist_apply_with_arg_func_t) php_tick_iterator, &amp;count ); } </code></pre> <p>Huh. Not bad.</p> <p>But here's the thing. If I <code>declare(ticks=1);</code>, the above dispatch is being run for literally every statement executed. That's... <em>ouch.</em> <strong>For long-running scripts containing high-iteration-count, tight processing loops</strong>, I'm wondering how badly that'll add up.</p> <p>Problem is, I'm not even sure how to benchmark this. The only way I could envisage to do so would be to synthesize some PHP bytecode and then figure out a way to inject that directly into the PHP bytecode interpreter.</p> <p>And that leads to my question: how much of a performance impact does this additional dispatch have, in practice? How can I quantify it?</p> <p>Obviously the above investigation was performed on the canonical PHP.net interpreter. I haven't looked into how HHVM does this at all (yet), but I wouldn't at all mind learning how it handles it.</p> </div>

lambda表达式查询两个时间之差的小时数

``` if (query.IsTime == true){ linq = linq.Where(sl => sl.EndTime == null || (new TimeSpan(sl.EndTime.Ticks)).Subtract(new TimeSpan(DateTime.Now.Ticks)).Minutes <= 20); }else { linq = linq.Where(s => (new TimeSpan(s.EndTime.Ticks)).Subtract(new TimeSpan(DateTime.Now.Ticks)).Minutes > 20); } ```

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

实现简单的文件系统

实验内容: 通过对具体的文件存储空间的管理、文件的物理结构、目录结构和文件操作的实现,加深对文件系统内部功能和实现过程的理解。 要求: 1.在内存中开辟一个虚拟磁盘空间作为文件存储器,在其上实现一个简

MIPS单周期CPU-组成原理实验-华中科技大学

使用logisim布线完成的MIPS单周期CPU,可支持28条指令。跑马灯的代码已经装入了寄存器,可以直接开启时钟运行。

2019数学建模A题高压油管的压力控制 省一论文即代码

2019数学建模A题高压油管的压力控制省一完整论文即详细C++和Matlab代码,希望对同学们有所帮助

基于QT和OpenCV的五子棋实现源码

一个简单的五子棋应用,基于QT和OpenCV的实现源码,通过相邻棋子判断是否获胜,不包含人工智能算法,适合新手入门

Git 实用技巧

这几年越来越多的开发团队使用了Git,掌握Git的使用已经越来越重要,已经是一个开发者必备的一项技能;但很多人在刚开始学习Git的时候会遇到很多疑问,比如之前使用过SVN的开发者想不通Git提交代码为什么需要先commit然后再去push,而不是一条命令一次性搞定; 更多的开发者对Git已经入门,不过在遇到一些代码冲突、需要恢复Git代码时候就不知所措,这个时候哪些对 Git掌握得比较好的少数人,就像团队中的神一样,在队友遇到 Git 相关的问题的时候用各种流利的操作来帮助队友于水火。 我去年刚加入新团队,发现一些同事对Git的常规操作没太大问题,但对Git的理解还是比较生疏,比如说分支和分支之间的关联关系、合并代码时候的冲突解决、提交代码前未拉取新代码导致冲突问题的处理等,我在协助处理这些问题的时候也记录各种问题的解决办法,希望整理后通过教程帮助到更多对Git操作进阶的开发者。 本期教程学习方法分为“掌握基础——稳步进阶——熟悉协作”三个层次。从掌握基础的 Git的推送和拉取开始,以案例进行演示,分析每一个步骤的操作方式和原理,从理解Git 工具的操作到学会代码存储结构、演示不同场景下Git遇到问题的不同处理方案。循序渐进让同学们掌握Git工具在团队协作中的整体协作流程。 在教程中会通过大量案例进行分析,案例会模拟在工作中遇到的问题,从最基础的代码提交和拉取、代码冲突解决、代码仓库的数据维护、Git服务端搭建等。为了让同学们容易理解,对Git简单易懂,文章中详细记录了详细的操作步骤,提供大量演示截图和解析。在教程的最后部分,会从提升团队整体效率的角度对Git工具进行讲解,包括规范操作、Gitlab的搭建、钩子事件的应用等。 为了让同学们可以利用碎片化时间来灵活学习,在教程文章中大程度降低了上下文的依赖,让大家可以在工作之余进行学习与实战,并同时掌握里面涉及的Git不常见操作的相关知识,理解Git工具在工作遇到的问题解决思路和方法,相信一定会对大家的前端技能进阶大有帮助。

实用主义学Python(小白也容易上手的Python实用案例)

原价169,限时立减100元! 系统掌握Python核心语法16点,轻松应对工作中80%以上的Python使用场景! 69元=72讲+源码+社群答疑+讲师社群分享会&nbsp; 【哪些人适合学习这门课程?】 1)大学生,平时只学习了Python理论,并未接触Python实战问题; 2)对Python实用技能掌握薄弱的人,自动化、爬虫、数据分析能让你快速提高工作效率; 3)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; 4)想修炼更好的编程内功,优秀的工程师肯定不能只会一门语言,Python语言功能强大、使用高效、简单易学。 【超实用技能】 从零开始 自动生成工作周报 职场升级 豆瓣电影数据爬取 实用案例 奥运冠军数据分析 自动化办公:通过Python自动化分析Excel数据并自动操作Word文档,最终获得一份基于Excel表格的数据分析报告。 豆瓣电影爬虫:通过Python自动爬取豆瓣电影信息并将电影图片保存到本地。 奥运会数据分析实战 简介:通过Python分析120年间奥运会的数据,从不同角度入手分析,从而得出一些有趣的结论。 【超人气老师】 二两 中国人工智能协会高级会员 生成对抗神经网络研究者 《深入浅出生成对抗网络:原理剖析与TensorFlow实现》一书作者 阿里云大学云学院导师 前大型游戏公司后端工程师 【超丰富实用案例】 0)图片背景去除案例 1)自动生成工作周报案例 2)豆瓣电影数据爬取案例 3)奥运会数据分析案例 4)自动处理邮件案例 5)github信息爬取/更新提醒案例 6)B站百大UP信息爬取与分析案例 7)构建自己的论文网站案例

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

C/C++跨平台研发从基础到高阶实战系列套餐

一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

Python界面版学生管理系统

前不久上传了一个控制台版本的学生管理系统,这个是Python界面版学生管理系统,这个是使用pycharm开发的一个有界面的学生管理系统,基本的增删改查,里面又演示视频和完整代码,有需要的伙伴可以自行下

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

linux“开发工具三剑客”速成攻略

工欲善其事,必先利其器。Vim+Git+Makefile是Linux环境下嵌入式开发常用的工具。本专题主要面向初次接触Linux的新手,熟练掌握工作中常用的工具,在以后的学习和工作中提高效率。

JAVA初级工程师面试36问(完结)

第三十一问: 说一下线程中sleep()和wait()区别? 1 . sleep()是让正在执行的线程主动让出CPU,当时间到了,在回到自己的线程让程序运行。但是它并没有释放同步资源锁只是让出。 2.wait()是让当前线程暂时退让出同步资源锁,让其他线程来获取到这个同步资源在调用notify()方法,才会让其解除wait状态,再次参与抢资源。 3. sleep()方法可以在任何地方使用,而wait()只能在同步方法或同步块使用。 ...

java jdk 8 帮助文档 中文 文档 chm 谷歌翻译

JDK1.8 API 中文谷歌翻译版 java帮助文档 JDK API java 帮助文档 谷歌翻译 JDK1.8 API 中文 谷歌翻译版 java帮助文档 Java最新帮助文档 本帮助文档是使用谷

我以为我对Mysql事务很熟,直到我遇到了阿里面试官

太惨了,面试又被吊打

智鼎(附答案).zip

并不是完整题库,但是有智鼎在线2019年9、10、11三个月的试题,有十七套以上题目,普通的网申行测题足以对付,可以在做题时自己总结一些规律,都不是很难

Visual Assist X 破解补丁

vs a's'sixt插件 支持vs2008-vs2019 亲测可以破解,希望可以帮助到大家

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

JavaWEB商城项目(包括数据库)

功能描述:包括用户的登录注册,以及个人资料的修改.商品的分类展示,详情,加入购物车,生成订单,到银行支付等!另外还有收货地址的和我的收藏等常用操作.环境(JDK 1.7 ,mysql 5.5,Ecli

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

一学即懂的计算机视觉(第一季)

图像处理和计算机视觉的课程大家已经看过很多,但总有“听不透”,“用不了”的感觉。课程致力于创建人人都能听的懂的计算机视觉,通过生动、细腻的讲解配合实战演练,让学生真正学懂、用会。 【超实用课程内容】 课程内容分为三篇,包括视觉系统构成,图像处理基础,特征提取与描述,运动跟踪,位姿估计,三维重构等内容。课程理论与实战结合,注重教学内容的可视化和工程实践,为人工智能视觉研发及算法工程师等相关高薪职位就业打下坚实基础。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/26281 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,但是大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化 下载方式:电脑登录https://edu.csdn.net/course/detail/26281,点击右下方课程资料、代码、课件等打包下载

软件测试2小时入门

本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

课程主要面向嵌入式Linux初学者、工程师、学生 主要从一下几方面进行讲解: 1.linux学习路线、基本命令、高级命令 2.shell、vi及vim入门讲解 3.软件安装下载、NFS、Samba、FTP等服务器配置及使用

2019 Python开发者日-培训

本次活动将秉承“只讲技术,拒绝空谈”的理念,邀请十余位身处一线的Python技术专家,重点围绕Web开发、自动化运维、数据分析、人工智能等技术模块,分享真实生产环境中使用Python应对IT挑战的真知灼见。此外,针对不同层次的开发者,大会还安排了深度培训实操环节,为开发者们带来更多深度实战的机会。

快速入门Android开发 视频 教程 android studio

这是一门快速入门Android开发课程,顾名思义是让大家能快速入门Android开发。 学完能让你学会如下知识点: Android的发展历程 搭建Java开发环境 搭建Android开发环境 Android Studio基础使用方法 Android Studio创建项目 项目运行到模拟器 项目运行到真实手机 Android中常用控件 排查开发中的错误 Android中请求网络 常用Android开发命令 快速入门Gradle构建系统 项目实战:看美图 常用Android Studio使用技巧 项目签名打包 如何上架市场

机器学习初学者必会的案例精讲

通过六个实际的编码项目,带领同学入门人工智能。这些项目涉及机器学习(回归,分类,聚类),深度学习(神经网络),底层数学算法,Weka数据挖掘,利用Git开源项目实战等。

4小时玩转微信小程序——基础入门与微信支付实战

这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

相关热词 c#框体中的退出函数 c# 按钮透明背景 c# idl 混编出错 c#在位置0处没有任何行 c# 循环给数组插入数据 c# 多线程死锁的例子 c# 钉钉读取员工排班 c# label 不显示 c#裁剪影像 c#工作进程更新ui
立即提问