Jump to content
JChartFX Community
  • 0

Axis Text


Question

7 answers to this question

Recommended Posts

  • 0

Hi,

 

The code I'm using is:

 

var chart1;


   function loadChart1()

     {

      // Create Chart

      chart1 = new cfx.Chart();

           chart1.setGallery(cfx.Gallery.Gantt);

chart1.getLegendBox().setVisible(false);

var td;

td = new cfx.TitleDockable();


chart1.getTitles().add(td);

chart1.getAllSeries().setStacked(cfx.Stacked.Normal);


chart1.getAllSeries().getBorder().setEffect(cfx.BorderEffect.Raised);

var data = chart1.getData();

chart1.getAnimations().getLoad().setEnabled(true);

data.setSeries(3);

data.setPoints(15);

data.setItem(0, 0, (-25));

data.setItem(0, 1, (-45));

data.setItem(0, 2, (-80));

data.setItem(0, 3, (-65));

data.setItem(0, 4, (-70));

data.setItem(0, 5, (-65));

data.setItem(0, 6, (-99));

data.setItem(0, 7, (-67));

data.setItem(0, 8, (-98));

data.setItem(0, 9, (-98));

data.setItem(0, 10, (-98));

data.setItem(0, 11, (-98));

data.setItem(0, 12, (-98));

data.setItem(0, 13, (-98));

data.setItem(0, 14, (-98));

data.setItem(1, 0, (34));

data.setItem(1, 1, (8));

data.setItem(1, 2, (54));

data.setItem(1, 3, (43));

data.setItem(1, 4, (12));

data.setItem(1, 5, (0));

data.setItem(1, 6, (39));

data.setItem(1, 7, (10));

data.setItem(1, 8, (28));

data.setItem(1, 9, (28));

data.setItem(1, 10, (28));

data.setItem(1, 11, (28));

data.setItem(1, 12, (28));

data.setItem(1, 13, (28));

data.setItem(1, 14, (0));

data.setItem(2, 5, (-50));

data.setItem(2, 14, (-28));

chart1.getAxisX().getTitle().setText("Sites");

chart1.getAxisX().getLabels().setItem(0, "Site Name A");

chart1.getAxisX().getLabels().setItem(1, "Site Name B");

chart1.getAxisX().getLabels().setItem(2, "Site Name C");

chart1.getAxisX().getLabels().setItem(3, "Site Name D");

chart1.getAxisX().getLabels().setItem(4, "Site Name E");

chart1.getAxisX().getLabels().setItem(5, "Site Name F");

chart1.getAxisX().getLabels().setItem(6, "Site Name G");

chart1.getAxisX().getLabels().setItem(7, "Site Name H");

chart1.getAxisX().setVisible(true);

chart1.create(document.getElementById('ChartDiv1'))

chart1.getLegendBox().setVisible(true);


     } 

Chart

http://78.154.97.206:7171/images/untitled.jpg 

Link to post
Share on other sites
  • 0

I tested your code and the axis appears correct, we recently checked in a change where we fixed an issue related to this.

The only change I would suggest in your code is that you are calling chart.create which will render the chart and then turning on the legend box which will cause the chart to be rendered again.

JuanC 

Link to post
Share on other sites
  • 0

You have our most recent public version, I meant that your code runs fine on our current development bits.

You can increase the minimum space on the left with a call like this

chart1.getPlotAreaMargin().setLeft(120);

JuanC 

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...