Jump to content
JChartFX Community
  • 0

X-Axis String value is not getting displyed


Question

Here is my code to draw line series. I was trying to create line chart with following data. Can you please help me what I am doing wrong here.

var items = [{"Date":"Thu 11/15/2012 18:34","Value":5972.0},{"Date":"Thu 11/15/2012 17:38","Value":4196.0},{"Date":"Thu 11/15/2012 16:53","Value":4198.0},{"Date":"Thu 11/15/2012 15:37","Value":4233.0},{"Date":"Thu 11/15/2012 14:38","Value":4401.0},{"Date":"Thu 11/15/2012 13:42","Value":4487.0}];

var assetForecastedGraph = new cfx.Chart();

assetForecastedGraph.getAllSeries().setMarkerShape(cfx.MarkerShape.None);

assetForecastedGraph.getLegendBox().setVisible(true);

assetForecastedGraph.getLegendBox().setBorder(cfx.DockBorder.Internal);

assetForecastedGraph.getLegendBox().setContentLayout(cfx.ContentLayout.Spread);

assetForecastedGraph.getLegendBox().setDock(cfx.DockArea.Bottom);

var axisY = assetForecastedGraph.getAxisY();

axisY.getGrids().getMinor().setVisible(true);

assetForecastedGraph.getAxisX().setLabelAngle(45);

var fields = assetForecastedGraph.getDataSourceSettings().getFields();

//alert(44);

var field1 = new cfx.FieldMap();

field1.setName("Value");

field1.setUsage(cfx.FieldUsage.Value);

fields.add(field1);

//alert(55);

var field2 = new cfx.FieldMap();

field2.setName("Date");

field2.setUsage(cfx.FieldUsage.XValue);

fields.add(field2);

// assetForecastedGraph.setGallery(cfx.Gallery.Bar);

// assetForecastedGraph.getAxisX().getLabelsFormat().setFormat(cfx.AxisFormat.DateTime);

assetForecastedGraph.getAxisX().getLabelsFormat().setCustomFormat("EEE MM/dd/yyyy HH:mm");

// alert(dataArray);

//alert(1);

assetForecastedGraph.setDataSource(items);

// alert(2);

var chartDiv = document.getElementById('historyChartContainer');

//alert(chartDiv);

assetForecastedGraph.create(chartDiv);

It

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

It has been fixed. I removed fields mapping, and it works fine.

I commented following lines:

var fields = assetForecastedGraph.getDataSourceSettings().getFields(); //alert(44); var field1 = new cfx.FieldMap(); field1.setName("Value"); field1.setUsage(cfx.FieldUsage.Value); fields.add(field1); //alert(55); var field2 = new cfx.FieldMap(); field2.setName("Date"); field2.setUsage(cfx.FieldUsage.XValue); fields.add(field2);

Thanks!!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...