I'm using ng2-charts to make line charts in my Angular 8 application. But, the line charts are being displayed as curved lines and not straight lines. I'm taking the code from the following link https://valor-software.com/ng2-charts/#/LineChart as you can see, the lines are not straight. How to make them straight lines?
Thanks.
Pass in bezierCurve: false into the options like this:
<canvas baseChart width="400" height="400"
[datasets]="lineChartData"
[labels]="lineChartLabels"
[options]="{bezierCurve: false}">
</canvas>
Or if you use the newer version lineTension: 0:
<canvas baseChart width="400" height="400"
[datasets]="lineChartData"
[labels]="lineChartLabels"
[options]="{lineTension: 0}">
</canvas>
Or if you want to affect a certain dataset:
<canvas baseChart width="400" height="400"
[datasets]="{data: data, lineTension: 0}"
[labels]="lineChartLabels"
[options]="lineChartOptions">
</canvas>
Unrelated question from OP:
I noticed that by default the area under the line graph has a color, I tried background-color:'none'; but that didn't work and it just put a grey color under it. Is there any way to not have any color under the line?
<canvas baseChart width="400" height="400"
[datasets]="{data: data, lineTension: 0, fill: false}"
[labels]="lineChartLabels"
[options]="lineChartOptions">
</canvas>
[datasets]="{fill: false}"
New version of ng2-chart are in this way:
Javascript Code:
public lineChartOptions: ChartConfiguration['options'] = {
elements: {
line: {
tension: 0
}
}
}
HTML Code:
<canvas baseChart
[data]="lineChartData"
[options]="lineChartOptions">
</canvas>
Related
I want a random number behind ?i=
<li>
<strong> Clip</strong> 2<br>
<iframe src="https://mysite.ml/links/clip2.html?i=" height="350" width="600" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>
</li>
First, make sure your iframe has an id attribute, for example:
<iframe id="myrandomiframe" src="" height="350" width="600" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>
Then onpageload, use JavaScript to set the src attribute with Math.random() appended, For example:
document.getElementById("myrandomiframe").setAttribute("src","https://mysite.ml/links/clip2.html?i=" + Math.random());
You'll have to do this when the page loads with JavaScript.
window.addEventListener('load', function(){
document.getElementsByTagName("iframe")[0].src += rando(Number.MAX_SAFE_INTEGER);
console.log(document.getElementsByTagName("iframe")[0].src);
});
<script src="https://randojs.com/1.0.0.js"></script>
<iframe src="example.com/?i="></iframe>
If you need to delve deeper into any of this, I used randojs.com to pick a number between 0 and Number.MAX_SAFE_INTEGER.
I need help drawing see through text for my weather app.
I need the temperature displayed in opacity for a nice look,
How can I do this in Canvas?
Please Help!
Thanks in advance!
You will have to play around with it but something like:
<html>
<body>
<canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
// code to draw picture as normal
ctx.globalAlpha = 0.5;
// code to draw text
</script>
</body>
</html>
I'm having an issue with Iframe autoplay="0" on Google Chrome.
I have tried every thread and and forum and nothing has worked.
I need the video to pause as soon as the page loads. I cannot use the <video> </video> tag because I need information to pull from a separate library into a main video div.
I haven't found any JavaScript that works and autostart="0" , autostart="false" autoplay="0" , autoplay="false" doesnt work either.
Link : Aza TV
<script>
$(".video-1, .video-2, .video-3").on("click", function(event) {
event.preventDefault();
$(".video_case iframe").prop("src", $(event.currentTarget).attr("href"));
});
</script>
.video_wrapper { width:67%; padding:10px; box-sizing:border-box; float:left; min-height:50px;border: thin solid #F60; border-radius:5px 5px;}
.nextvideo_wrapper { width:31%; padding:8px; box-sizing:border-box; float:left; min-height:400px;border: thin solid #F60; border-radius:5px 5px;margin-left:10px; background:#333;}
<div class="video_wrapper">
<iframe name="someFrame" id="someFrame" width="100%" height="420" src="http://41.76.210.2/vod/azamusica_VictoriaKimani_webisode22_20151022_HDO.mp4?autoplay=0" controls ></iframe>
</div>
<div class="nextvideo_wrapper">
<iframe src="libraries/azamuzika.php" width="100%" height="400px" bg=ffffff&text=000000" frameborder="0"></iframe>
</div>
Please note your selector does not actually match the html you posted.
To keep it simple try to add &autoplay=0 to your urls - if that does not work, try this - I gave the actual iframe an ID of iFrame1 and write the video tag into it
var vid = '<video controls="controls"><source src="__VIDEO__" type="video/mp4" /><!--[if gt IE 6]><object width="640" height="375" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"><! [endif]--><!--[if !IE]><!--><object width="640" height="375" type="video/quicktime" data="__VIDEO__.mp4"><!--<![endif]--><param name="src" value="__VIDEO__" /><param name="autoplay" value="false" /></object></video>';
$(".video-1, .video-2, .video-3").on("click", function(event) {
event.preventDefault();
var ifrm = $('#iFrame1').get(0); // get the DOM object
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.write(vid.replace(/__VIDEO__/g,$(event.currentTarget).attr("href"));
ifrm.document.close();
});
I've tried all the possible solutions but nothing worked for local video bindings. I believe best solution would be to fix using jQuery.
$(document).ready(function () {
var ownVideos = $("iframe");
$.each(ownVideos, function (i, video) {
var frameContent = $(video).contents().find('body').html();
if (frameContent) {
$(video).contents().find('body').html(frameContent.replace("autoplay", ""));
}
});
});
Note: It'll find all the iframes on document ready and loop through each iframe contents and replace/remove autoplay attribute. This solution can be use anywhere in your project. If you would like to do for specific element then use the code under $.each function and replace $(video) with your iframe element id like $("#myIFrameId").
I am pulling my hair out trying to embed a flash file I have in a page, and have tried many variations of the following two ways:
swfobject
<head>
<%= javascript_include_tag 'swfobject.js' %>
</head>
.
.
.
<div id="dragndrop">This requires Adobe Flash to view</div>
<script type="text/javascript">
var flashvars;
var params = {
movie: "<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>",
background: "#FFFFFF",
quality: "high"
};
swfobject.embedSWF("<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>",
"dragndrop", "100%", "100%", "6.0.0", false, params);
</script>
Navigating to the page yields nothing, but outputs the following in browser:
<object id="dragndrop" width="100%" height="100%" type="application/x-shockwave-flash"
data="/assets/flash/drag-n-drop-w-action3b.swf" style="visibility: visible;">
<param name="flashvars" value="movie=/assets/flash/drag-n-drop-w-action3b.swf&background=#FFFFFF&quality=high">
</object>
I have tried it without the params, also, to no avail.
I have also tried manually adding it in several ways including as described here. This flash file is currently embedded on a different website successfully, and I have even copy-pasted the html there (fixing the path):
<object width="100%" height="100%" align=""
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="assets/flash/drag-n-drop-w-action3b.swf" name="movie">
<param value="high" name="quality">
<param value="#FFFFFF" name="bgcolor">
<embed width="100%" height="100%" align=""
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" bgcolor="#FFFFFF" quality="high"
src="/assets/flash/drag-n-drop-w-action3b.swf">
</object>
What am I doing wrong?
EDIT:
Following pipwerks help, I changed the code to:
var params = { background: "#FFFFFF",};
swfobject.embedSWF("<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>", "dragndrop", "100%", "100%", "6.0.0", false, false, params);
However, it is still not quite working. The new HTML that is outputted is as follows:
<object id="dragndrop" width="100%" height="100%" type="application/x-shockwave-flash"
data="/assets/flash/drag-n-drop-w-action3b.swf" style="visibility: visible;">
<param name="background" value="#FFFFFF">
</object>
For starters, you're accidentally passing the parameters as flashvars.
Secondly, you don't need to pass most of those parameters, as they're already taken care of. The movie param is the first argument in SWFObject. quality=high is the default for Flash Player and doesn't need to be specified. I believe #FFFFFF is also the default background color, but it wouldn't hurt to specify it.
The correct order of arguments is:
swfobject.embedSWF([swf file],
[document element id],
[width],
[height],
[min Flash Player version],
[express install swf or false],
[flashvars obj or false],
[params obj or false],
[attributes obj or false],
[callback function or false]);
Therefore your code should be:
var params = { background: "#FFFFFF",};
swfobject.embedSWF("<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>", "dragndrop", "100%", "100%", "6.0.0", false, false, params);
See this page for more details about swfobject arguments.
i have some layers of canvas:
<canvas id="layer1" width="700" height="700" class="pageCanvas"> </canvas>
<canvas id="layer2" width="700" height="700" class="pageCanvas"> </canvas>
<canvas id="layer3" width="700" height="700" class="pageCanvas"> </canvas>
and i'd like to put images of canvases
layer1 and layer2
to canvas
layer3.
I'll be glad if you write down the code because I couldn't find any good explanation over the internet.
thanks``
combine two canvas and put it to layer3:
var canvas1 = document.getElementById('layer1');
var canvas2 = document.getElementById('layer2');
var canvas3 = document.getElementById('layer3');
canvas3.drawImage(canvas1, 0, 0);
canvas3.drawImage(canvas2, 0, 0);