|
Limiting X axis |
Posted by Ram on Mar-02-2016 02:32 |
|
Hi ,
I am trying to set the X axis between the limit but this is throwing an error.am i making my mistake defining the x axis.
FYKI,I am using XY chart and javascript as my language.
var xScaleMin = toChartTime(2015,10,18,0,0,0);
var xScaleMax = toChartTime(2015,12,28,0,0,0);
cXY.xAxis().setLinearScale(xScaleMin, xScaleMax);
pls help.
Thanks,
Ram |
Re: Limiting X axis |
Posted by Ram on Mar-02-2016 05:08 |
|
Missed the exact funtion which I am using;
function number(Title, data, aTimes, strLabelFormat, StartTime, EndTime, scaleMin, scaleMax, iTick)
{
for (var i = 0; i < data.length; i++)
{
var aTimes()=chartTime(2016, 2, 18) + 5 * 3600 * i;
}
var chartWidth = 800;
var chartHeight = 320;
strLabelFormat = ("{value|mm/dd}");
var cXY = chartDirector.XYChart(chartWidth, chartHeight);
var plotArea = cXY.setPlotArea(80, 20, chartWidth - 30 - 80 - 80, chartHeight - 110);
//cXY.xAxis().setLabels(labels);
cXY.xAxis().setDateScale(chartTime(2016, 2, 18), chartTime(2016, 2, 20), 86400);
cXY.xAxis().setLabelFormat(strLabelFormat);
var layer = cXY.addAreaLayer(data,0X0000FF00);
layer.setXData(aTimes);
cXY.yAxis().setTitle("no");
cXY.xAxis().setTitle("Date");
cXY.xAxis().setTitlePos(chartDirector.BottomCenter);
insertChart("", cXY);
}
but the above is not working.Please suggest. |
Re: Limiting X axis |
Posted by Peter Kwan on Mar-02-2016 16:50 |
|
Hi Ram,
As you are using Javascript, I assume you are using ChartDirector for ASP/COM/VB.
In your code, I see that you use chartDirector.XYChart. I assume the chartDirector is the ChartDirector.API object your code created using "new ActiveXObject".
The chartTime is a method of the ChartDirector.API object, so instead of using chartTime, it should be chartDirector.chartTime.
Also, by reading your code, I cannot understand the line:
var aTimes()=chartTime(2016, 2, 18) + 5 * 3600 * i;
I am not sure exactly what is aTimes (it is a parameter passing into your function), but the code itself seems to be invalid Javascript syntax.
If you need further help, please let me know what is the error message and the line that the error message occur. It can be related to ChartDirector, or unrelated to ChartDirector (such as typing mistake in the code or syntax error).
Hope this can help.
Regards
Peter Kwan |
Re: Limiting X axis |
Posted by Ram on Mar-02-2016 19:16 |
|
Thank You Peter for the response.
Yes we are using ChartDirector.
I will use this and try chartDirector.chartTime but as you mentioned this could be Syntax error too.
Basically I wanted to draw a graph from x-axis (2015,10,18) to (2015,10,28),so i am using the only previous I posted.
I think I am making another mistake on defining the aTimes and I would like to know how we can define this for this specific X axis scale.
layer.setXData(aTimes);
Thank you so much for your help.
Ram |
Re: Limiting X axis |
Posted by Peter Kwan on Mar-03-2016 04:38 |
|
Hi Ram,
To set up the x-axis from (2015,10,18) to (2015,10,28), please use:
cXY.xAxis().setDateScale(chartDirector.chartTime(2015, 10, 18), chartDirector.chartTime(2015, 10, 28), 86400);
The data are the y-coordinates of your data points, and aTimes are the x-coordinates of your data points. If you just want to spread the data points from chartDirector.chartTime(2015, 10, 18), chartDirector.chartTime(2015, 10, 28) evenly spaced, you may use the following code:
Call layer.setXData2(chartDirector.chartTime(2015, 10, 18), chartDirector.chartTime(2015, 10, 28))
Hope this can help.
Regards
Peter Kwan |
Re: Limiting X axis |
Posted by Peter Kwan on Mar-03-2016 04:38 |
|
Hi Ram,
To set up the x-axis from (2015,10,18) to (2015,10,28), please use:
cXY.xAxis().setDateScale(chartDirector.chartTime(2015, 10, 18), chartDirector.chartTime(2015, 10, 28), 86400);
The data are the y-coordinates of your data points, and aTimes are the x-coordinates of your data points. If you just want to spread the data points from chartDirector.chartTime(2015, 10, 18), chartDirector.chartTime(2015, 10, 28) evenly spaced, you may use the following code:
layer.setXData2(chartDirector.chartTime(2015, 10, 18), chartDirector.chartTime(2015, 10, 28));
Hope this can help.
Regards
Peter Kwan |
Re: Limiting X axis |
Posted by Ram on Mar-03-2016 15:37 |
|
Thank you Peter !!.It worked. |
|