Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
This post was edited and submitted for review 25 days ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
enter image description here
Here's how to do it!
I can do with css position, but I don't need it.
For drawing any path on the chart you can choose SVGRenderer#path, there you can define coordinates and set attributes.
Highcharts.mapChart('container', {
...
}, function(chart) {
chart.renderer.path(['M', 0, 430, 'L', 800, 430])
.attr({
'stroke-width': 2,
stroke: 'red',
zIndex: 4
})
.add();
});
Demo: https://jsfiddle.net/BlackLabel/54bx97no/
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Like our avatars: is it possible to create a simple avatar that i can use as placeholder for my users?
and extending that: how far can you go with the art preferences: colors, shape etc.
Link only answers are frowned upon but I think I'll take the risk: There are several libraries for those so called identicons Sampson linked to. The code there is Java (or looks very similar). A pure JavaScript implementation seems to be jdidenticon. You have more possibilities with PHP (you can use e.g.: ImageMagick and similar) but JavaScript is cheaper for your load ;-)
It is possible to create 2D and 3D graphics with javascript and the HTML5 tag canvas
<canvas><canvas>
Inside your javascript code you define what should painted inside your canvas
var context = document.getElementById("canvasId").getContext("2d");
var width = 125; // Triangle Width
var height = 105; // Triangle Height
var padding = 20;
// Draw a path
context.beginPath();
context.moveTo(padding + width/2, padding); // Top Corner
context.lineTo(padding + width, height + padding); // Bottom Right
context.lineTo(padding, height + padding); // Bottom Left
context.closePath();
// Fill the path
context.fillStyle = "#ffc821";
context.fill();
<canvas id="canvasId" width="165" height="145"></canvas>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Check This ImageI want to Make a Circular Progress Bar for my Website.Which Change Its Starting Point With Button Click. For Example, When Button 1 Clicked It Should Rotate From 270 Degrees, When Button 2 Clicked It Should Rotate From 0 degree,When Button 3 clicked It Should Rotate From 90 degrees and When Button 4 Clicked It Should Start from 180 degrees.....
Please Help Me
Thanks In Advance..
Keep in mind first that this is not a clear answer, cause a right one would take me time of coding.
I recently used a open-source library from github. Here is the link.
https://github.com/kottenator/jquery-circle-progress
It is exactly what you want (with some modifications).
Here is the example. https://kottenator.github.io/jquery-circle-progress/
If you see the fourth progress circle, you see that you can set your own starting angle.
Let me here explain how can this achieve having Example four as my reference:
/*
* Example 4:
* - solid color fill
* - custom start angle
* - custom line cap
* - dynamic value set
*/
var c4 = $('.forth.circle');
c4.circleProgress({
startAngle: -Math.PI / 4 * 3,
value: 0.5,
lineCap: 'round',
fill: { color: '#ffa500' }
});
With StartAgle you can set the start value of the progress bar.
You can easy update your code to make the circle over and over again until the content you want load.
See the usage of the library here : https://github.com/kottenator/jquery-circle-progress#usage
See that answer too:
https://stackoverflow.com/a/13371976/4108694
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have this SVG square that I want to be able to rotate and drag, how can I use Raphael JS to do this?
This is the SVG i want to manipulate:
<svg width="100" height="100"><rect width="300" height="100" style="fill:rgb(0,0,0);stroke-width:3;stroke:rgb(0,0,0)" /></svg>
Raphael.Freetransform handles dragging, rotating and scaling of individual elements and sets.
var paper = Raphael('holder');
var rect = paper
.rect(200, 200, 100, 100)
.attr('fill', '#f00');
// Add freeTransform
var ft = paper.freeTransform(rect);
// Hide freeTransform handles
ft.hideHandles();
// Show hidden freeTransform handles
ft.showHandles();
// Apply transformations programmatically
ft.attrs.rotate = 45;
ft.apply();
// Remove freeTransform completely
ft.unplug();
// Add freeTransform with options and callback
ft = paper.freeTransform(rect, { keepRatio: true }, function(ft, events) {
console.log(ft.attrs);
});
// Change options on the fly
ft.setOpts({ keepRatio: false });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://alias.io/raphael/free_transform/raphael.js"></script>
<script src="https://alias.io/raphael/free_transform/raphael.free_transform/raphael.free_transform.js"></script>
<div id="holder"></div>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
If I have a map in SVG format, how can I scale the image to be say, X times bigger? How would I achieve this? I want to be able to scale it based on an X variable which of course varies
I have looked into it but I am stretched for time. I just want to know where to begin.
To scale SVG data you need to use a scale transformation.
So to make an element, e.g 3 times bigger you would use:
var mySVG = document.getElementById("mySvgElement");
var scaleCoefficient = 3; //this will make it 3 times bigger in x/y direction
mySVG.setAttribute("transform", "scale(" + scaleCoefficient + "," + scaleCoefficient + ")");
That will apply a scale transformation of '3' in x/y directions thus making the element 3 times bigger without changing it's aspect ratio
SVG elements are defined by a transformation matrix - this is what vector shapes generally use to define translation/rotation/size without changing the actual SVG geometry data of the shapes themselves.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Is it possible to extract the colors from an image of any type using javascript? i want the percentage of each color in the image as well.
To get the base 64 encoded image data,
function getBase64FromImage(img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
return canvas.toDataURL("image/png").replace(/^data:image\/(png|jpg);base64,/, "");
}
You'll probably want to have a library process the image data, rather than doing it yourself:
What is the best JavaScript image processing library?
Yes this is possible. You need to load the image on a canvas. Then you can extract the color on each arbitrary x,y coordinate.
You might want to have a look at
http://lokeshdhakar.com/projects/color-thief/
getPixel from HTML Canvas?
How to fetch a remote image to display in a canvas?
How to add image to canvas