Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to update DataSet of X-Axis after created a chart
Allen2009
Hi,
I create a chart by serializing a Chart file, and now I have two arrays to set Data of both Axes.
I dont use Datebase,
I tried "chart.getSeriesForLegend()[0].getRunTimeSeries().get(0).setDataSet(orthoValues);"
but I dont know how to change the values of A-Axis
please help !
thanks in advance
Liang
Find more posts tagged with
Comments
Davolio
I don't know if this will help you but this is the code I use to change the values of the labels of the x-axis of the chart, if you want to change the actual values... I'm not quite sure, you could probably tweak them will fetching the data.
Here's how I change my axislabels.
function beforeDrawAxisLabel(axis, label, icsc)
{
if(axis.getType() == AxisType.LINEAR_LITERAL){
//we want to show percents so lets buff up the formatting
var actualval = Number(label.getCaption().getValue());
actualval = actualval * 100;
actualval = actualval.toFixed(1);
actualval = String(actualval) + "%";
label.getCaption().setValue(actualval);
axis.setLabel(label);
}
}
If you're looking for actual values to change, I'd create a scripted datasource, do all of your data manipulation in the dataset from the datasource; then chart it as is, I wouldn't suggest doing a whole lot of your data maniplulation on the chart.
I think it would be better to do it in a dataset then chart the manipulated dataset.
Hope that helps,
Dave
Allen2009
Hi Dave,
Thanks a lot for your help,
I have tried ,just like you said,
//here create my Chart
chart = ****.createChart();
//something new data come.
categoryValues = something new;
Series ds = ((ChartWithAxes)chart).getPrimaryBaseAxes()[0].getRuntimeSeries()[0];
ds.setDataSet(categoryValues);
and it works !
I used Date_Time_LITERAL as typ for X-Axis.
Thanks a lot for your idea !!
Liang