I'm trying to set the visible range of a DateAxis. Here's what I have:
final IXyDataSeries<Date, Double> dataSeries = sciChartBuilder.newXyDataSeries(Date.class, Double.class).build();
final IAxis xBottomAxis = sciChartBuilder.newDateAxis()
.withAxisId("xBottomAxis")
.build();
xBottomAxis.setAutoRange(AutoRange.Never);
xBottomAxis.setTextFormatting("MM.dd.yyyy h:mm a");
Calendar rightNow = Calendar.getInstance();
long t = rightNow.getTimeInMillis();
Date rightNowPlusFiveMin = new Date(t + (5 * ONE_MINUTE_IN_MILLIS));
Date rightNowMinusThreeHr = new Date(t - (3 * ONE_HOUR_IN_MILLIS));
xBottomAxis.setVisibleRange(new DateRange(rightNowMinusThreeHr, rightNowPlusFiveMin));
This should keep it from AutoRanging and set the default min and max on the xBottomAxis. Is this not how you do it?
Currently, it's just AutoRanging to fit the data.
Edit: Here are the applicable links for its documentation.
https://www.scichart.com/documentation/android/v2.x/webframe.html#Axis%20Ranging%20-%20VisibleRange%20and%20DataRange.html
https://www.scichart.com/documentation/android/v2.x/webframe.html#Axis%20Ranging%20-%20Setting%20and%20Getting%20VisibleRange.html
I tried to copy-paste your code in this example and it worked as expected - axis was rendered with assigned VisibleRange value.
I noticed that you used custom AxisId for your DateAxis. Does it mean that you have more than one XAxis and maybe your RenderableSeries is attached to wrong axis?
Also I would suggest you to update to the latest version of the library - it could be possible that if it's a bug then it's already fixed in latest build.
If it doesn't help then you'll need to provide more code or entire project which reproduces this issue because with code which you provided it's hard to tell what could be the cause of this issue.
It looks like removing mySciChartSurface.zoomExtents() fixed it. Link to zoomExtents documentation.
Thanks to Yura Khariton for the help.
Related
Recently we migrated java code to OCI environment from AWS environment.
Below is the code which is giving issue.
sql.addSQLToWhereClause(XXXTable, "? between table1.start_date and table1.end_date")
.addSQLToWhereClause(YYYTable, "table1.ORG_ID = ? ")
.addSQLToWhereClause(XXXTable, "table1.LANG_CODE = ? ")
.bind(new Date())
.bind(ConstValues.ORG_ID)
.bind(locale.toString().toUpperCase());
In AWS environment it is working fine, but in OCI environment we are getting error:
ORA-01830: date format picture ends before converting entire input string
We are getting this error because .bind(new Date()) is putting '07-JAN-2021 10:49:04' in the first parameter. But expected value is '07-JAN-2021'
Please suggest why this additional information is coming in current date and how can we remove it without changing java code.
Thanks
Rahul
Object instances of Java's java.util.Date class always had the time portion in it. Why it should behave differently on AWS … – no idea!
But I assume that the implementation of bind(java.util.Date) is different in those environments, because the implementation of Date.toString() will come with a completely different output than that shown in the question.
So please check the version for the library that provides the respective class.
Hello I have a lot of automatic issue creation and commenting in JIRA. And wanted to add to the issue a customField named "Number of automatic updates" that increments everytime an issues is commented. The tipical solution for this is using the number of comments but that is not possible in because the comments are limited programatically to 20. So in this case I would always have at max 20.
Is there any straightforward method that makes it possible to do so?
I'm trying this approach but it keeps giving me exception and errors related to the CustomField Object:
MutableIssue issue = IM.getIssueObject(alreadyReportedIssueId);
private static final String COMMENTNUMBER_CUSTOMFIELD_ID = "commentnumber-customfield-id";
private static final CustomField customFieldObject = CustomFieldManager.getCustomFieldObjectByName(COMMENTNUMBER_CUSTOMFIELD_ID);
issue.setCustomFieldValue(COMMENTNUMBER_CUSTOMFIELD_ID, (Integer.parseInt(customFieldObject.getValue(issue))++));
PS: The version of JIRA I'm using is: version 3.13.5
This seems trivial with the Jira REST API?
https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/updating-an-issue-via-the-jira-rest-apis
related to this bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7028073 i need to fix the display of the currency format for PERU.
How can i change the properties for de locale of PE_es?
Currenctly the currency is shown as S/ but it should be "S/.".
Can i just replace the properties file? i am looking for a soluction in the jre instalation or the code. I have tried looking for the file without luck.
Java version is 1.7.0 _22 b11
Thanks
The bug you mentioned is already fixed in the version 8u34. However, starting tomorrow, there will be a new "bug" (until it is changed/fixed).
Starting Dic 15th, the Peruvian Symbol will be S/ (without the dot).
Depending on which version of the JVM you currently have, you may (or may not) run into this problem. In case you currently have the last version, your only options might be:
Use a workaround for Peruvian Currency
Wait until they update the JVM with the change so you can update it.
Regarding the second point, you may also want to file a bug/change report (similar to the bug_id 7028073).
Source: El Peruano (Article 2) (Source is in Spanish).
A possible solution for that is make a little function to make it manually:
public String getPeruvianCurrencyFormat(double value)
{
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setGroupingUsed(true);
return "S/. " + nf.format(value);
}
I have an older version of sugarcrm 4.5 running.
Dont brake that aint broken.
I have a script i wrote that adds 30 days from current date to expected close date when creating a new opportunity, but the problem is everytime you edit the opportunity it adds 30 days, and not just when its is new. How do i tel Sugar to only look for new. this is in editview.php not a logic hook as i want to display the date in the field when creating.
Heres my code
var currentTime = new Date();
document.getElementsByName('date_closed')[0].value = (year = currentTime.getFullYear())+'-'+(month = currentTime.getMonth() + 2)+'-'+(day = currentTime.getDate());
regards
This should be done with a before save logic hook - you can test to see if the record has an id in the hook. If it has no id then you can assume its a new record.
More information on logic hooks can be found here (you are using a very old version of SugarCRM so not everything in this documentation will apply)
http://developers.sugarcrm.com/docs/OS/5.2/-docs-Developer_Guides-Developer_Guide_5.2-DevGuide%205.2.1.47.html
I'm wondering if there is any way to specify for example tomorrow as date in the DBUnit XML dataset. Sometimes code logic is different for dates in future and dates in the past and I want to test both cases. For sure I can specify something like the 5th of November 2239 and be sure that test will work till this date but are there more elegant way.
I haven't yet faced such situation during my Java development but once I had experience when code logic was different for one day before dates, two days before dates and more than two days before dates. In this case the only possible solution to write database driven test is to insert relative dates during data import.
Are there any facilities provided by the DBUnit for this?
I just started using DBUnit and was looking for similar capabilities. Unfortunately there doesn't seem to be an expression language for dates in the framework. However, I did find a suitable workaround using DBUnit's ReplacementDataSet class. This class takes an IDataSet object and exposes methods to replace objects extracted by the IDataSet object from the data set files.
dataset
<dataset>
<user first_name="Dan"
last_name="Smith"
create_date="[create_date]"/>
<dataset>
source code
String dataSetFile = "testDataFile.xml";
IDataSet dataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile));
ReplacementDataSet rDataSet = new ReplacementDataSet(dataSet);
Set<String> keys = dataSetAdjustments.keySet();
rDataSet.addReplacementObject("[create_date]", DateUtils.addDays(new Date(), -2));
Now, when the test runs the user's creation data will always be set to two days before the test was run.
Hope this helps. Good luck.
A new relative date/time syntax has been added in DbUnit 2.7.0 and you can now write [now+1d] to set tomorrow's date without any extra setup.
<dataset>
<user create_date="[now+1d]"/>
<dataset>
The doc is here:
http://dbunit.sourceforge.net/datatypes.html#relativedatetime
A few examples from the doc:
[now] : current date time
[now-1d] : the same time yesterday
[now+1y+1M-2h] : a year and a month from today, two hours earlier
[now+1d 10:00] : 10 o'clock tomorrow
I've managed to achieve that with something really similar to what #loyalBrown did, but I couldn't do exactly like that as some further information was missing there and I was instantiating my current datasource with #DatabaseSetup("/pathToXML")
So that's what I did:
First I needed to remove the annotation, you need now to start this .xml file programatically with the following code:
#Inject
protected DataSource dataSource;
#Before
public void setUp() throws Exception {
DataSourceDatabaseTester dataSourceDatabaseTester = new DataSourceDatabaseTester(dataSource);
IDataSet dataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(getClass().getResource(DATASET_FILE_LOCATION).getPath()));
ReplacementDataSet rDataSet = new ReplacementDataSet(dataSet);
rDataSet.addReplacementObject("{$today}", new Date());
dataSourceDatabaseTester.setDataSet(rDataSet);
dataSourceDatabaseTester.onSetup();
}
This seemed to do the trick
You can use add() of Calendar to define dates in the future and using this in relationship with datasource for JUnit. I doubt that this would work with DBUnit's XML format. May be you create your own TestCase which extends from DBTestCase and implement getDataSet() method.