Jump to content
JChartFX Community
  • 0

Y axis - not coming...with Gallery type Contour


Peter P

Question

Hi all I am new to jchartfx as well as to this forum, I was trying to create contour plot, finally could able to plot something but not able to see y axis label and tickmark..after setting it to true.. is it bug ?

Here is my code..


<!DOCTYPE html>
<html>
<head>
   <link rel="stylesheet" type="text/css" href="styles/chartfx.css" />
   <script type="text/javascript" src="js/jchartfx.system.js"></script>
   <script type="text/javascript" src="js/jchartfx.coreBasic.js"></script>
   <script type="text/javascript" src="js/jchartfx.surface.js"></script>
  <script type="text/javascript" src="js/jchartfx.advanced.js"></script>
</head>
<body onload="loadChart()">
<div id="ChartDiv" style="width:700px;height:400px"></div>
<script type="text/javascript" language="javascript">
    var chart1;

    function loadChart()
      {       
           
chart1 = new cfx.Chart();

chart1.getView3D().setEnabled(true);
chart1.setGallery(cfx.Gallery.Contour);

// Legend
chart1.getLegendBox().setVisible(true);

// Y axis - BUG not working...with Contour...type...
chart1.getAxisY().setVisible(true);
chart1.getAxisY().getTitle().setText("Y axis");


// X axis
chart1.getAxisX().setVisible(true);
chart1.getAxisX().getTitle().setText("X axis");

// contour lines...
var myContour;
myContour = (chart1.getGalleryAttributes());
myContour.setShowContourLines(true);

// color
chart1.getSeries().getItem(0).setColor("#FFFF00");
chart1.getSeries().getItem(0).setAlternateColor("#FF0000");


var series0;
series0 = chart1.getSeries().getItem(0);

var data = chart1.getData();
data.setSeries(1);
data.setPoints(1);

data.setItem(0, 0, (6));
data.setItem(0, 1, (4));
data.setItem(0, 2, (6.53333));
data.setItem(0, 3, (9.06667));
data.setItem(0, 4, (11.6));
data.setItem(0, 5, (14.1333));
data.setItem(0, 6, (16.6667));
data.setItem(0, 7, (19.2));
data.setItem(0, 8, (21.7333));
data.setItem(0, 9, (24.2667));
data.setItem(0, 10, (26.8));
data.setItem(0, 11, (29.3333));
data.setItem(0, 12, (31.8667));
data.setItem(0, 13, (34.4));
data.setItem(0, 14, (36.9333));
data.setItem(0, 15, (39.4667));
data.setItem(0, 16, (42));

data.setItem(1, 0, (-42));
data.setItem(1, 1, (-2.71329));
data.setItem(1, 2, (-3.4446));
data.setItem(1, 3, (-3.78734));
data.setItem(1, 4, (-4.09721));
data.setItem(1, 5, (-6.15704));
data.setItem(1, 6, (-16.2005));
data.setItem(1, 7, (-45.9343));
data.setItem(1, 8, (-92.6726));
data.setItem(1, 9, (-130.143));
data.setItem(1, 10, (-140.923));
data.setItem(1, 11, (-110.025));
data.setItem(1, 12, (-7.63413));
data.setItem(1, 13, (92.7351));
data.setItem(1, 14, (113.672));
data.setItem(1, 15, (113.503));
data.setItem(1, 16, (107.908));

data.setItem(2, 0, (-36.4667));
data.setItem(2, 1, (-1.03757));
data.setItem(2, 2, (-2.40257));
data.setItem(2, 3, (-3.05481));
data.setItem(2, 4, (-3.05952));
data.setItem(2, 5, (-3.69744));
data.setItem(2, 6, (-12.0621));
data.setItem(2, 7, (-49.0469));
data.setItem(2, 8, (-115.385));
data.setItem(2, 9, (-166.741));
data.setItem(2, 10, (-186.512));
data.setItem(2, 11, (-177.638));
data.setItem(2, 12, (-95.5658));
data.setItem(2, 13, (56.161));
data.setItem(2, 14, (106.383));
data.setItem(2, 15, (109.179));
data.setItem(2, 16, (102.617));

data.setItem(3, 0, (-30.9333));
data.setItem(3, 1, (1.99388));
data.setItem(3, 2, (-0.609091));
data.setItem(3, 3, (-2.63713));
data.setItem(3, 4, (-3.00171));
data.setItem(3, 5, (-3.39824));
data.setItem(3, 6, (-11.6456));
data.setItem(3, 7, (-52.9805));
data.setItem(3, 8, (-129.356));
data.setItem(3, 9, (-184.744));
data.setItem(3, 10, (-201.8));
data.setItem(3, 11, (-201.068));
data.setItem(3, 12, (-161.547));
data.setItem(3, 13, (-29.8455));
data.setItem(3, 14, (63.3911));
data.setItem(3, 15, (85.9153));
data.setItem(3, 16, (86.1561));

data.setItem(4, 0, (-25.4));
data.setItem(4, 1, (8.52344));
data.setItem(4, 2, (5.90586));
data.setItem(4, 3, (1.12362));
data.setItem(4, 4, (-1.69735));
data.setItem(4, 5, (-3.44627));
data.setItem(4, 6, (-13.8068));
data.setItem(4, 7, (-53.2133));
data.setItem(4, 8, (-123.431));
data.setItem(4, 9, (-180.02));
data.setItem(4, 10, (-199.933));
data.setItem(4, 11, (-199.138));
data.setItem(4, 12, (-168.943));
data.setItem(4, 13, (-82.4096));
data.setItem(4, 14, (5.18132));
data.setItem(4, 15, (47.6905));
data.setItem(4, 16, (62.6947));

data.setItem(5, 0, (-19.8667));
data.setItem(5, 1, (19.0215));
data.setItem(5, 2, (22.2575));
data.setItem(5, 3, (19.878));
data.setItem(5, 4, (12.665));
data.setItem(5, 5, (4.48484));
data.setItem(5, 6, (-9.42676));
data.setItem(5, 7, (-40.7757));
data.setItem(5, 8, (-92.8498));
data.setItem(5, 9, (-145.374));
data.setItem(5, 10, (-173.375));
data.setItem(5, 11, (-172.423));
data.setItem(5, 12, (-140.973));
data.setItem(5, 13, (-80.8786));
data.setItem(5, 14, (-18.3727));
data.setItem(5, 15, (24.2753));
data.setItem(5, 16, (48.3381));

data.setItem(6, 0, (-14.3333));
data.setItem(6, 1, (28.1949));
data.setItem(6, 2, (39.4502));
data.setItem(6, 3, (43.2961));
data.setItem(6, 4, (37.3221));
data.setItem(6, 5, (22.9248));
data.setItem(6, 6, (5.27561));
data.setItem(6, 7, (-15.8562));
data.setItem(6, 8, (-43.3953));
data.setItem(6, 9, (-75.4634));
data.setItem(6, 10, (-100.157));
data.setItem(6, 11, (-103.542));
data.setItem(6, 12, (-82.721));
data.setItem(6, 13, (-45.3517));
data.setItem(6, 14, (-4.3098));
data.setItem(6, 15, (30.1905));
data.setItem(6, 16, (55.1778));

data.setItem(7, 0, (-8.8));
data.setItem(7, 1, (29.0254));
data.setItem(7, 2, (47.3025));
data.setItem(7, 3, (51.5816));
data.setItem(7, 4, (48.0164));
data.setItem(7, 5, (34.5271));
data.setItem(7, 6, (18.7251));
data.setItem(7, 7, (10.6854));
data.setItem(7, 8, (8.59763));
data.setItem(7, 9, (4.25642));
data.setItem(7, 10, (-6.02074));
data.setItem(7, 11, (-15.1062));
data.setItem(7, 12, (-12.4162));
data.setItem(7, 13, (4.9304));
data.setItem(7, 14, (31.8244));
data.setItem(7, 15, (60.0439));
data.setItem(7, 16, (83.1622));

data.setItem(8, 0, (-3.26667));
data.setItem(8, 1, (11.1096));
data.setItem(8, 2, (42.2766));
data.setItem(8, 3, (51.3963));
data.setItem(8, 4, (47.2718));
data.setItem(8, 5, (33.9853));
data.setItem(8, 6, (23.9979));
data.setItem(8, 7, (31.3979));
data.setItem(8, 8, (49.7691));
data.setItem(8, 9, (62.6329));
data.setItem(8, 10, (59.5809));
data.setItem(8, 11, (46.1927));
data.setItem(8, 12, (39.0646));
data.setItem(8, 13, (48.9724));
data.setItem(8, 14, (73.8583));
data.setItem(8, 15, (102.688));
data.setItem(8, 16, (124.773));

data.setItem(9, 0, (2.26667));
data.setItem(9, 1, (-12.8378));
data.setItem(9, 2, (2.23583));
data.setItem(9, 3, (30.8503));
data.setItem(9, 4, (31.1923));
data.setItem(9, 5, (20.8487));
data.setItem(9, 6, (20.9446));
data.setItem(9, 7, (43.1237));
data.setItem(9, 8, (76.2823));
data.setItem(9, 9, (98.9658));
data.setItem(9, 10, (93.8695));
data.setItem(9, 11, (72.0934));
data.setItem(9, 12, (62.4846));
data.setItem(9, 13, (78.4007));
data.setItem(9, 14, (113.835));
data.setItem(9, 15, (149.023));
data.setItem(9, 16, (169.625));


data.setItem(10, 0, (7.8));
data.setItem(10, 1, (-14.9978));
data.setItem(10, 2, (-13.3808));
data.setItem(10, 3, (-4.75909));
data.setItem(10, 4, (-3.83839));
data.setItem(10, 5, (-6.75949));
data.setItem(10, 6, (6.72683));
data.setItem(10, 7, (37.4565));
data.setItem(10, 8, (79.3808));
data.setItem(10, 9, (118.996));
data.setItem(10, 10, (107.915));
data.setItem(10, 11, (69.3488));
data.setItem(10, 12, (65.335));
data.setItem(10, 13, (98.4907));
data.setItem(10, 14, (151.454));
data.setItem(10, 15, (190.55));
data.setItem(10, 16, (205.534));


data.setItem(11, 0, (13.3333));
data.setItem(11, 1, (-16.8584));
data.setItem(11, 2, (-21.5467));
data.setItem(11, 3, (-39.3078));
data.setItem(11, 4, (-59.57));
data.setItem(11, 5, (-56.9148));
data.setItem(11, 6, (-25.2237));
data.setItem(11, 7, (7.34204));
data.setItem(11, 8, (16.2087));
data.setItem(11, 9, (2.43648));
data.setItem(11, 10, (11.6964));
data.setItem(11, 11, (28.4585));
data.setItem(11, 12, (59.1516));
data.setItem(11, 13, (117.67));
data.setItem(11, 14, (183.202));
data.setItem(11, 15, (216.396));
data.setItem(11, 16, (223.487));

data.setItem(12, 0, (18.8667));
data.setItem(12, 1, (-40.9058));
data.setItem(12, 2, (-69.6484));
data.setItem(12, 3, (-124.719));
data.setItem(12, 4, (-162.1));
data.setItem(12, 5, (-146.118));
data.setItem(12, 6, (-82.514));
data.setItem(12, 7, (-28.9939));
data.setItem(12, 8, (-37.7043));
data.setItem(12, 9, (-71.7596));
data.setItem(12, 10, (-59.5731));
data.setItem(12, 11, (0.802786));
data.setItem(12, 12, (69.2031));
data.setItem(12, 13, (141.074));
data.setItem(12, 14, (201.036));
data.setItem(12, 15, (224.394));
data.setItem(12, 16, (226.985));

data.setItem(13, 0, (24.4));
data.setItem(13, 1, (-105.466));
data.setItem(13, 2, (-170.062));
data.setItem(13, 3, (-240.618));
data.setItem(13, 4, (-270.105));
data.setItem(13, 5, (-249.94));
data.setItem(13, 6, (-165.77));
data.setItem(13, 7, (-63.5736));
data.setItem(13, 8, (-32.8047));
data.setItem(13, 9, (-39.9982));
data.setItem(13, 10, (-17.8439));
data.setItem(13, 11, (55.7808));
data.setItem(13, 12, (130.671));
data.setItem(13, 13, (176.517));
data.setItem(13, 14, (207.781));
data.setItem(13, 15, (223.422));
data.setItem(13, 16, (226.318));



chart1.create(document.getElementById('ChartDiv'))    
      }

</script>
</body>
</html>

 


 

 

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

A contour is a surface chart seen from above so the Y axis is not visible, if you add labels to the series we will display them to the right, note that there might be a bug in our code that calculates the required space so I am setting manually

var s = chart1.getSeries();

for(var i = 0;i<14;i++) {

    s.getItem(i).setText("Label " + (i + 1));

}

chart1.getPlotAreaMargin().setRight(80);

 

JuanC 

Link to comment
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...