Can give currency pattern in yaxis tickLabel in jqplot? [closed] - jqplot

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
Here is my script
<script type="text/javascript">
function my_ext() {
this.cfg.axes.yaxis.tickOptions = {
formatString : ''
};
}
</script>
I want to format the numbers on my axis like this: 100,000,000.00. How do I do this in jqplot?

This is the formatting you need:
tickOptions:{formatString:"%'.2f"}
' for the english numeration
.2 is the number of digit after the point

Related

Skiasharp Export canvas to image [closed]

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 3 years ago.
Improve this question
I have a question.
I have a skiasharp canvas with a few bitmaps. Now I want to export the canvas with the bitmaps to an Image, but I have no idea how to do that, or if that is possible.
Can someone help me?
You are probably looking to take a Snapshot of the Surface.
using (var image = surface.Snapshot())
using (var data = image.Encode(SKEncodedImageFormat.Png, 80))
using (var stream = File.OpenWrite(Path.Combine(FolderPath, "1.png")))
{
// save the data to a stream
data.SaveTo(stream);
}
This is very similar to MShah's answer, but just from a snapshot of the surface instead, given that surface is a reference to your Skia Surface.
To convert the bitmap to image:
using (var image = SKImage.FromBitmap(yourBitmap))
using (var data = image.Encode(SKEncodedImageFormat.Png, 80))
{
// save the data to a stream
using (var stream = File.OpenWrite(Path.Combine(FolderPath, "1.png")))
{
data.SaveTo(stream);
}
}
Edit:
To convert canvas to png:
SKImage mainCanvasImage = surface.Snapshot();
SKBitmap TempTIFbitmap1 = SKBitmap.Decode(mainCanvasImage.Encode())
Use the above code from point 1 to save this.
hope this will resolve your issue.

Children elements didn't inherit parent data with D3 force layout [closed]

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 6 years ago.
Improve this question
I have created a d3 force layout,and works very well.
My mainly code like so:
var nodes = [{id:1, n:'n_1',np:'0'},{id:2, n:'n_2',np:'0'}];//just for demo
//1. set data
var update = svg.selectAll(".node").data(nodes);
//2. enter
update.enter().append("svg:g").attr("class", "node")
.call(function(p){
p.append("svg:image").attr("class", "nodeimage");
p.append("svg:text").attr("class", "nodetext");
});
//3. exit
update.exit().remove();
As is known to us, d3.selectAll(".node").data() is my data. Because the child elements of g will inherit the data from the parent data, d3.selectAll(".nodeimage").data() is also my data.Am I right?
In fact, my data nodes is from backend, and the data is updated. For example, some properties like np have been changed from 0 to 1. We consider the result is
nodes = [{id:1, n:'n_1',np:'1'},{id:2, n:'n_2',np:'0'}];
I need to call the function above again. However,d3.selectAll(".node").data() is right, while d3.selectAll(".nodeimage").data() is wrong now.
The following code will not work well.
d3.selectAll('.nodeimage').attr("test", function(d){
//d.np is a wrong value.
});
Any suggestions for me?
Here is my demo of jsfiddle:http://jsfiddle.net/bpKG4/663/
This is a strange behavior of d3. If I understand correctly (which is not granted), selection.data(...) automatically transfers data to child elements, unless they already have some data binded.
In your case, it means that you need to copy "by hand" the data to each child:
//select any child node, then:
.each(function() {
d3.select(this).datum(d3.select(this.parentNode).datum());
})
NB: in your fiddle, you only set the xlink:href in the enter() selection: this is wrong, you need to set it within the whole update selection.
update.selectAll(".nodeimage")
.each(function() {
d3.select(this).datum(d3.select(this.parentNode).datum());
})
.attr("xlink:href", function(d){
var img;
if(d.np == 1){
img = "http://www.gravatar.com/avatar/1eccef322f0beef11e0e47ed7963189b/?default=&s=80"
}else{
img = "http://www.gravatar.com/avatar/a1338368fe0b4f3d301398a79c171987/?default=&s=80";
}
return img;
});
See here: http://jsfiddle.net/cs4xhs7s/1/

How to align value axis width? [closed]

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 6 years ago.
Improve this question
chart
I want to align value axis above chart and below chart.
How to set axis width?
The simplest way to go about it is to set minMarginLeft to the same number on both charts.
I.e.:
AmCharts.makeChart( "chart1", {
"type": "serial",
"minMarginLeft": 80,
// ...
} );
AmCharts.makeChart( "chart2", {
"type": "serial",
"minMarginLeft": 80,
// ...
} );

Finding longPress release Location [closed]

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 3 years ago.
Improve this question
I'm Using LongPress on control and drag different positions in views. I found out the starting position using UIGestureRecognizerStateBegan. how do i found out the UIGestureRecognizerStateChanged position?
if( UIGestureRecognizerStateChanged)
{
CGPoint center = snapshot.center;
center.y = location.y;
snapshot.center = center;
}
if (UIGestureRecognizerStateEnded)
{
location = [longPress locationInView:self.tableView];
}

Is there a way to generate more than 20 colors in D3? [duplicate]

This question already has answers here:
How can I generate as many colors as I want using d3?
(8 answers)
Closed 7 years ago.
According to the D3 Wiki. there is a scale function d3.scale.category20() that
Constructs a new ordinal scale with a range of twenty categorical
colors:
Question: is there anything that one can do to generate more than 20 unique colors? I was hoping to get at least 50.
By looking at the source code for that method:
d3.scale.category20 = function() {
return d3.scale.ordinal().range(d3_category20);
};
var d3_category20 = [
0x1f77b4, 0xaec7e8,
0xff7f0e, 0xffbb78,
0x2ca02c, 0x98df8a,
0xd62728, 0xff9896,
0x9467bd, 0xc5b0d5,
0x8c564b, 0xc49c94,
0xe377c2, 0xf7b6d2,
0x7f7f7f, 0xc7c7c7,
0xbcbd22, 0xdbdb8d,
0x17becf, 0x9edae5
].map(d3_rgbString);
You should be able to call d3.scale.ordinal().range(...) on your own color list.

Resources