I have implemented meter guage chart it is working fine. I want multiple needles on the same meter. Is that possible?
For Ex: if we have
s1 = [122,80]; or s1 = [122,80];s2 = [200];
in this case can we get multiple needles but on the same meter.
In short, no. Like you, I have tried a number of things, but the normal approach to the series would be:
s1 = [122];s2 = [200];
series = [s1, s2];
plot = $.jqplot('chart',series,{ ... });
... but this is clearly not working. And I couldn't find such a thing in the documentation either.
I hope it becomes available in a future release too.
Related
Im implementing the code below in a React, Typescript project.
When hovering over my graph I don't get the nearest entity its roughly 5 years off, on my x-axis(time).
I've tried switching out entityNearest for entityNearestXThenY but it yielded similar results.
Below is my pointer interaction function:
new Plottable.Interactions.Pointer()
.attachTo(Chart)
.onPointerMove(function(p) {
var entity = hiddenGraph.entityNearest(p);
var date = parseTime(entity.datum.x);
var value = currencySymbolNoPrecision(entity.datum.y);
var displayValue = (value + " • " + date);
guideline.value(entity.datum.x);
xAxis.annotatedTicks([entity.datum.x]);
title.text(displayValue).yAlignment();
})
.onPointerExit(function() {
guideline.pixelPosition(-10);
xAxis.annotatedTicks([]);
});
Pointer tracking is also very jumpy. My dataset is the gold price per month since 1950. I've checked the dataset to ensure that there are no problems there.
In the image below my mouse is hovering roughly where the red circle is.
Please let me know if I can provide any further information.
I eventually reached a solution by directly editing the coordinates of the mouse after it had bean calculated:
.onPointerMove(p){
p={x: p.x-(compensationValue), y:p.y}
...
...
...
}
While I understand this is by far not the best solution to the problem I had, it has managed to resolve the problem and seemingly with no adverse effects on different screen sizes or when nesting components.
So this is a question regarding a rather specific problem. As I know from Gordon, main contributor of dc.js, there is no support for elasticY(true) function for logarithmic scales.
So, after knowing this, I tried to implement my own solution, by building a workaround, inside dc.js's renderlet event. This event is always triggered by a click of the user onto the barchart. What I wanted to do is this:
let groupSize = this.getGroupSize(fakeGroup, this.yValue);
let maximum = group.top(1)[0].value;
let minimum = group.top(groupSize)[groupSize-1].value;
console.log(minimum, maximum);
chart.y(d3.scale.log().domain([minimum, maximum])
.range(this.height, 0)
.nice()
.clamp(true));
I thought, that at this point the "fakeGroup" (which is just group.top(50)) contains only the data points that are NOT filtered out after the user clicked somewhere. However, this group always contains all data points that are in the top 50 and doesn't change on filter events.
What I really wanted is get all data points that are NOT filtered out, to get a new maximum and minimum for the yScale and rescale the yAxis accordingly by calling chart.y(...) again.
Is there any way to get only data rows that are still in the chart and not filtered out. I also tried using remove_empty_bins(group) but didn't have any luck with that. Somewhere is always all() or top() missing, even after giving remove_empty_bins both functions.
This is how i solved it:
I made a function called rescale(), which looks like this:
rescale(chart, group, fakeGroup) {
let groupSize = this.getGroupSize(fakeGroup, this.yValue);
let minTop = group.top(groupSize)[groupSize-1].value;
let minimum = minTop > 0 ? minTop : 0.0001;
let maximum = group.top(1)[0].value;
chart.y(d3.scale.log().domain([minimum, maximum])
.range(this.height, 0)
.nice()
.clamp(true));}
I think the parameters are pretty self-explanatory, I just get my chart, the whole group as set by dimension.group.reduceSum and a fake group I created, which contains the top 50 elements, to reduce bar count of my chart.
The rescale() method is called in the event listener
chart.on('preRedraw', (chart) => {
this.rescale(chart, group, fakeGroup);
}
So what I do is re-defining (re-setting min and max values regarding filtered data) the charts yAxis everytime the chart gets redrawn, which happens to also be every time one of my charts is filtered. So now, the scale always fits the filtered data the chart contains after filtering another chart.
I have a bunch of numbers in the millions. I want to use them in labels on my d3 bar chart, formatted like $23M -- but for some reason, my decimals are sticking around.
My read of the documentation says that $,.0f should work, if I first divide by 1000000.
I have var millions = d3.format("^$,.f"); and then I call it later with
.text(function(d) {
return (millions(d.money / 1000000) + "M");
})
I'm still seeing digits after the decimal. What am I doing wrong?
I found a handy site that demonstrates a variety of formatting strings on any number you give it, and when I plug my format in, it looks like it ought to work, but in my code, it doesn't work.
Tinkerable version at https://jsfiddle.net/a1ppt754/
Instead of
var millions = d3.format("^$,.f");
do this way
var millions = d3.format("^$f");
working code here
I am getting more than ...slightly flustered... at trying to do what should otherwise be a very, very simple task.
I want to use a particular figure, say, figure(3), for doing imagesc. So in the beginning of my code, I always do this:
f3 = figure(3);
a3 = gca;
Then, I get some matrix data, of arbitrary size. Say that I got data of size 231 x 322. Now, I want to tell MATLAB, to perform imagesc(data), but on figure(3).
How do I do that?? imagesc doesnt take figure or axes handles, and this is becoming very, very frustrating... thanks!
imagesc takes a 'parent' parameter. This is indirectly documented via the image function.
For example:
imdata = imread('ngc6543a.jpg');
f = figure;
a1 = subplot(211);
a2 = subplot(212);
image(imdata,'parent',a1);
imagesc(imdata,'parent',a2);
In one of my windows application, wherein I am using TChart for .Net 2010, I am displaying a chart with 3 error series on it. Each of these series have 2 points. X points for all these series are identical.
e.g. Series1 has Point1(x1=0.2, bar=0, StdErr=5) & Point2(x1=0.6, bar=1, StdErr=8) whereas Series2 has Point1(x1=0.2, bar=0, StdErr=8) & Point2(x1=0.6, bar=1, StdErr=10).
The expected chart should display overlapped error bars at 2 locations 0.2 and 0.6 on x axis. But in fact, it displaying error bars with sufficient separation between them.
Is this a problem with TChart or do I need to have some settings to overlap these error bars? Please let me know if anyone has solution for it.
thanks,
kapil
This is not a TeeChart problem but default behaviour. All series deriving from Steema.TeeChart.Styles.CustomBar class have MultiBar property which lets the programmer choose how bars will be plotted in such circumstances. By default MultiBar is set to Steema.TeeChart.Styles.MultiBars.Side. Setting it to Steema.TeeChart.Styles.MultiBars.None solves your problem, for example:
tChart1.Aspect.View3D = false;
for (int i = 0; i < 3; i++)
{
Steema.TeeChart.Styles.ErrorBar errorBar = new Steema.TeeChart.Styles.ErrorBar(tChart1.Chart);
errorBar.MultiBar = Steema.TeeChart.Styles.MultiBars.None;
errorBar.FillSampleValues();
}
If that's not what you were looking for you can try with different MultiBar settings and let us know if it still doesn't fit your needs.