Error series vanishes on resizing window - c#-4.0

Following plot has a error series Series2 which is not displayed on this chart, but legends says about its existence. This series needs to be displayed with minimum y value as infinity. But, Tee chart doesn't have any provision to specify -Infinity directly. So, we defined a huge negative number instead; which is significantly larger than the y axis to give an appearance of -Infinity to the user. But, if the chart area becomes too small compared to this huge negative number, the series (here series2) vanishes entirely.
Here is the series data used -
Series2 Points:
X-------------------->>Bar-------------------->>Std. Error
1432 --------->> -50.19380462 ----------->> 50.20619538
1797 ---------->> 50.19380462 ----------->> 50.20619538
2164 ---------->> -50.19380462 ----------->> 50.20619538
2529 --------->> -50.19380462 ----------->> 50.20619538
Can anyone please help to resolve this issue?
Thanking you.

The next release of TeeChart for .NET includes support for extended Axis ranges, from Double.MinValue to Double.MaxValue, and goes some way further to handle infinite value issues. That doesn't say for sure that it will resolve the issue you describe here. If you are able to send Steema Support a sample project that shows the issue we can test it with the new release.

Related

Table values moved after being added to old QGIS version: behaves normally on current version

I am teaching a man the basics of QGis for a project he needs to do at his work. He has very little computer knowledge and would like to standardise the work as much as possible (specific workarounds would complicate it too much for him). His QGis version is 3.16 "Hannover" and as this is a work laptop he does not have permission to download a newer version.
We have been having problem with one specific table. The first few rows are below, written exactly as they are originally.
Baum-Nr. Baumart BHD Alter Y X Biotopbaum Klassifizierung Bemerkungen
1 Buche 86 120 49.1356 11.0488 A Altbaum Freistellen !!!
2 Kiefer 45 100 49.13561 11.04883 Hlb,Bs,Th Höhlenbaum
3 Kiefer 32 100 49.13571 11.04579 Hlb,Sw,Th Höhlenbaum
4 Kiefer 74 120 49.13513 11.0495 A Altbaum
After adding it from Excel to QGis through "add vector layer", the header "Klassifizierung" becomes one of the coordinates and I believe one of the columns are switched (unfortunately, I can't remember specifics. This is a small side job and I haven't had time to look into it for days. I should have taken a photo, but this isn't possible anymore). We have attempted to copy the column into a new Excel document and transferring it to QGis again, and this time the headers were shoved one cell to the right such that "Y" was placed over "X" and "Biotopbaum" over "Klassifizierung", for example.
I could not find a way to fix the import problem in his laptop. He e-mailed me the problematic table and I opened it successfully in my QGis 3.26 "Buenos Aires".
I believe this may be a problem with his QGis version, but it is curious that we only encountered it with this one table. All other tables we have worked with have the same headers and the same kind of data on their respective rows.
Is this a known problem, or have other people faced similar situations? Could someone explain what could be causing it? Would there be a way to fix it such that we can successfully import the table without having to edit it in QGis? This is not a solution the man would accept.
Thank you in advance.
Remove the commas in the Biotopbaum field or replace them with a less common delimiter. In fact, remove all punctionation (e.g., Baum-Nr. >> remove the period ".").
Also save the table into a csv format and try to import.

Specify the specific heat of a material with Revit 2017 Python API

With Revit 2017 Python API, I am trying to create new materials, and then assembling some of these to create new type of walls.
It goes pretty well for all properties, except for the specific heat!
Basically, what I do is:
create a thermalAsset:
themalA = ThermalAsset('Test', ThermalMaterialType.Solid)
Set the different thermal properties for that thermal asset (dummy values):
thermalA.ThermalConductivity = 0.01
thermalA.SpecificHeat = 0.001
thermalA.Density = 1000.0
Then I create a PropertySetElement with that thermal asset:
pse = PropertySetElement.Create(doc, thermalA)
Then I assign it to my material (that I previously created):
mat.SetMaterialAspectByPropertySet(MaterialAspect.Thermal, pse)
Afetr that, I take a look in my materials list in Revit, and look at the thermal properties. Everything seems ok, except the Specific Heat, which remains at 0.0239 btu/(lb. F), whatever the value I input when I assign the specific heat. Density is ok, thermal conductivity is ok, but not specific heat.
I got no error message.
What am I missing?
Thanks a lot for any help.
Arnaud.
Is the value you specify in the expected unit? Feet per Kelvin, squared-second. Cf., http://thebuildingcoder.typepad.com/blog/2013/04/whats-new-in-the-revit-2014-api.html > ThermalAsset.SpecificHeat.
I submitted this to the development team for further analysis as issue REVIT-111206 [API: setting ThermalAsset SpecificHeat fails]. Can you please provide a full reproducible case for them to test, e.g., a minimal RVT model with an embedded macro to run, cf., http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b? Thank you!

How to connect specific attributes over polar coordinates in R?

I have highlighted specific activities (feeding,resting and sleeping) from the dataset in my plot. Now I want to connect these highlighted points in sequence over my polar coordinates.
Here's my dataset:
Activity Latitude Longitude
Feeding 21.09542 71.06014
Resting 21.09564 71.06064
Sleeping 21.09619 71.06128
Walking 21.09636 71.06242
Walking 21.09667 71.06564
Resting 21.09483 71.06619
Can you help me out in this?
# Example dataframe
set.seed(1)
mydf=data.frame(Activity=sample(c("Walking","Feeding","Resting","Sleeping"),20,T),Latitude=rnorm(20,21,0.5),Longitude=rnorm(20,71,0.5))
mydf$Order=1:nrow(mydf)
If you want to connect the points in order regardless of the activity, do the following (for clarity, I added the variable mydf$Order to label the points).
# Plot
library(ggplot2)
ggplot(data=mydf)+
geom_point(aes(x=Latitude,y=Longitude,colour=Activity))+
geom_path(aes(x=Latitude,y=Longitude))+
geom_text(aes(x=Latitude,y=Longitude,label=Order))+
coord_polar(theta="y")
If you want to connect points according to activities, consider CMichael's answer.
Ok I am starting from scratch: My original answerwas much too bulky and inflexible.
Just add the following to get Paths for each Activity without filtering.
+ geom_path(aes(colour=ACTIVITY,x=Latitude,y=Longitude))
If you want to plot only selected Activities:
+ geom_path(data=Data[Data$ACTIVITY %in% c("Sleeping","Resting"),],aes(colour=ACTIVITY,x=Latitude,y=Longitude))
The selected Activities are to be listed in the c(...) vector with each name quoted.
UPDATE: OP clarified that he wants to connect any stationary point, this achieved by running the following:
+ geom_path(data=Data[Data$ACTIVITY!="Walking",],colour="red",aes(x=Latitude,y=Longitude))
Note that the colour=ACTIVITY is removed from the aesthetics and we consider all stationary points (!="Walking") to draw the path.
Code combining the two answers:
set.seed(1)
mydf=data.frame(Activity=sample(c("Walking","Walking","Walking","Walking","Walking","Resting","Feeding","Sleeping"),20,T),Latitude=rnorm(20,21,0.5),Longitude=rnorm(20,71,0.5))
mydf$Order=1:nrow(mydf)
# Plot
library(ggplot2)
ggplot(data=mydf)+
geom_point(aes(x=Latitude,y=Longitude,colour=Activity),size=5)+
geom_path(aes(x=Latitude,y=Longitude),size=1.2)+
geom_text(aes(x=Latitude,y=Longitude,label=Order))+
geom_path(data=mydf[mydf$Activity!="Walking",],colour="red",aes(x=Latitude,y=Longitude)) +
coord_polar(theta="y")

Problems with jqPlot / Primefaces extender and Date values

so here's the thing.
I've got plenty of persisted "Snapshots" containing a java.sql.Timestamp and (for the sake of simplicity) an int as data.
I have a JSF page containing a primefaces 3.4.1 <p:lineChart> and behind that a ManagedBean that contains the model for the chart.
Let's say I then select a time range and fetch all the Snapshots in between that range.
and populate the data model for the chart with all the Timestamps (x-axis) and all the integers (y-axis).
So what i do while populating is:
data = new HashMap<Object, Number>();
List<Snapshot> allSnapshots = persistenceService.getAllSnapshots();
for(int i = 0; i < allSnapshots.size(); i++) {
Snapshot s = allSnapshots.get(i);
data.put(new Date(s.getTimestamp().getTime()), s.getData());
}
chartModel.getSeries().get(0).setData(data);
(Note: in the example code I just fetch all Snapshots, as I quickly just generated a hundred or so).
I set up the chart like this:
<p:lineChart id="chart" value="#{backingBean.chartModel}" xaxisAngle="-90">
<f:convertDateTime pattern="HH:mm:ss"/>
</p:lineChart>
It works ok but when the model contains a hundred data points, the xaxis is just overcrowded with all the tickmarks.
What I then did is to use the primefaces' option to use a jqplot extender function.
So I just add extender="extend" as attribute for the chart, where extend is the following js function :
function extend() {
this.cfg.axes = {
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
rendererOptions: { tickRenderer: $.jqplot.CanvasAxisTickRenderer },
tickOptions: {
showGridline: true,
formatString: '%H:%M',
angle: -90
}
}
}
}
This is the current version of it..
After hours of reading and trial and error, I still cannot get it right, as the following things are just never right:
The tick marks never get rendered as the Date never gets converted.
At the moment this is just ignored and the formatString itself is
displayed...
Additional tick marks are created left and right of the actual data,
I dont want that.
When I only give autoscale: true as option for the jqplot extender,
I would expect just the spacing between the marks turn ok. But what
then happens is, that the spacing is cool but the original date
labels turn into just bare numbers starting from 0 to the amount of data available.. !?
I am getting a little tired from dealing with this.....maybe I am doing something fundamentally wrong. Otherwise I have no idea why this is so complicated..
Thanks for any advice!
Cheers
Chris
EDIT:
Ok thanks to perissf, I checked this one : https://stackoverflow.com/a/14287971/870122
With the suggested extender I get the following output :
http://www.abload.de/img/clipboard01y6sgj.png
(sorry I cannot post the image directly due to new user restrictions :-/ )
As you can see the tick marks are rendered correctly as HH:MM, thats very nice.
But as you also can see another quite weird problem occurs:
The given time range of the snapshots is
Start time: 2013-01-28 13:01:25.415
End time: 2013-01-28 13:14:32.145
I collected these as UTC timestamps with System.currentTimeMillis() while the JVM is set to UTC in the glassfish config.
As you notice, the datapoints in the plot are shifted one hour, they start at 14:01, which looks like the values have been auto-converted to my current timezone which is UTC+1. But the leftmost xaxis tick is placed at around the original UTC value at 13:00.
I collect the timestamps UTC as I dont know in which actual timezone the application will be running, but I'd like to display the "translated" time value. So the auto shift to my timezone is a nice feature, but the xaxis scaling is actually not nice and weird.
Any suggestions how I get rid of that ?
Cheers
Chris
EDIT2:
Ok while debugging the rendered page with Firebug I stumbled upon the jqplot internal variables in the plot object, which seem to contain the min and max values for the xaxis.
Min is set to the original min UTC value which is around 13:00, and max is set to the shifted UTC+1 value around 14:15.
Somehow the min value is not shifted accordingly to the automatic timezone adjustments.
All other values, that is dataBounds, data itself and so on, are all shifted nicely by one hour.
I opened a issue at Bitbucket jqplot issue tracker
Let's see.
Bye
Chris
i finally debugged the jqplot renderer and found some lines of code that cause this behaviour.
For anyone interested, please find the bugfix in the comment section here:
Bitbucket issue tracker
Thanks for any help
I'm very interested in this fix but the issues on BitBucket are in a restricted area so I cannot access it. So I had myself to try to fix this AxisDateRenderer and fortunately I did :)
So the Primefaces (6.0) chart uses an old version of the JQPlot library. A bug in this version sets the minimum date axis bound being not the first value exactly, but a time older according to the locale time zone of the user browser. For example, if the first value is at 12:00 and your GMT is GMT+1, then the date axis bound minimum will be at 11:00 instead of 12:00 !
The minVale
The following line (in createTicks function) should bed replaced (note the code is written minified below)
ad = ad.getTime() + ad.getUtcOffset();
By the next line:
ad = Math.floor((ad.getTime() - ad.getUtcOffset())/r) * r + ad.getUtcOffset();
Non minified line to replace:
min = min.getTime() + min.getUtcOffset();
With:
min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
Note that I have tried to update the chart.js of Primefaces to an earlier version , but the chart do not work anymore. I will wait for the next update of Primefaces hoping that a newer version is used. I also don't know which version of JQPlot is used in Primefaces 6.0

In MATLAB, how do I plot to an image and save the result without displaying it?

This question kind of starts where this question ends up. MATLAB has a powerful and flexible image display system which lets you use the imshow and plot commands to display complex images and then save the result. For example:
im = imread('image.tif');
f = figure, imshow(im, 'Border', 'tight');
rectangle('Position', [100, 100, 10, 10]);
print(f, '-r80', '-dtiff', 'image2.tif');
This works great.
The problem is that if you are doing a lot of image processing, it starts to be real drag to show every image you create - you mostly want to just save them. I know I could start directly writing to an image and then saving the result. But using plot/rectangle/imshow is so easy, so I'm hoping there is a command that can let me call plot, imshow etc, not display the results and then save what would have been displayed. Anyone know any quick solutions for this?
Alternatively, a quick way to put a spline onto a bitmap might work...
When you create the figure you set the Visibile property to Off.
f = figure('visible','off')
Which in your case would be
im = imread('image.tif');
f = figure('visible','off'), imshow(im, 'Border', 'tight');
rectangle('Position', [100, 100, 10, 10]);
print(f, '-r80', '-dtiff', 'image2.tif');
And if you want to view it again you can do
set(f,'visible','on')
The simple answer to your question is given by Bessi and Mr Fooz: set the 'Visible' setting for the figure to 'off'. Although it's very easy to use commands like IMSHOW and PRINT to generate figures, I'll summarize why I think it's not necessarily the best option:
As illustrated by Mr Fooz's answer, there are many other factors that come into play when trying to save figures as images. The type of output you get is going to be dependent on many figure and axes settings, thus increasing the likelihood that you will not get the output you want. This could be especially problematic if you have your figures set to be invisible, since you won't notice some discrepancy that could be caused by a change in a default setting for the figure or axes. In short, your output becomes highly sensitive to a number of settings that you would then have to add to your code to control your output, as Mr Fooz's example shows.
Even if you're not viewing the figures as they are made, you're still probably making MATLAB do more work than is really necessary. Graphics objects are still created, even if they are not rendered. If speed is a concern, generating images from figures doesn't seem like the ideal solution.
My suggestion is to actually modify the image data directly and save it using IMWRITE. It may not be as easy as using IMSHOW and other plotting solutions, but I think it is more efficient and gives more robust and consistent results that are not as sensitive to various plot settings. For the example you give, I believe the alternative code for creating a black rectangle would look something like this:
im = imread('image.tif');
[r,c,d] = size(im);
x0 = 100;
y0 = 100;
w = 10;
h = 10;
x = [x0:x0+w x0*ones(1,h+1) x0:x0+w (x0+w)*ones(1,h+1)];
y = [y0*ones(1,w+1) y0:y0+h (y0+h)*ones(1,w+1) y0:y0+h];
index = sub2ind([r c],y,x);
im(index) = 0;
im(index+r*c) = 0;
im(index+2*r*c) = 0;
imwrite(im,'image2.tif');
I'm expanding on Bessi's solution here a bit. I've found that it's very helpful to know how to have the image take up the whole figure and to be able to tightly control the output image size.
% prevent the figure window from appearing at all
f = figure('visible','off');
% alternative way of hiding an existing figure
set(f, 'visible','off'); % can use the GCF function instead
% If you start getting odd error messages or blank images,
% add in a DRAWNOW call. Sometimes it helps fix rendering
% bugs, especially in long-running scripts on Linux.
%drawnow;
% optional: have the axes take up the whole figure
subplot('position', [0 0 1 1]);
% show the image and rectangle
im = imread('peppers.png');
imshow(im, 'border','tight');
rectangle('Position', [100, 100, 10, 10]);
% Save the image, controlling exactly the output
% image size (in this case, making it equal to
% the input's).
[H,W,D] = size(im);
dpi = 100;
set(f, 'paperposition', [0 0 W/dpi H/dpi]);
set(f, 'papersize', [W/dpi H/dpi]);
print(f, sprintf('-r%d',dpi), '-dtiff', 'image2.tif');
If you'd like to render the figure to a matrix, type "help #avifile/addframe", then extract the subfunction called "getFrameForFigure". It's a Mathworks-supplied function that uses some (currently) undocumented ways of extracting data from figure.
Here is a completely different answer:
If you want an image file out, why not just save the image instead of the entire figure?
im = magic(10)
imwrite(im/max(im(:)),'magic.jpg')
Then prove that it worked.
imshow('magic.jpg')
This can be done for indexed and RGB also for different output formats.
You could use -noFigureWindows to disable all figures.

Resources