How do i specify a start value for the Y axis?

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Ananth on 26th September 2017
Hi Richard,

how do i specify start value for y axis or indent like if my array value for data is [0, 689, 699, 700, 0] and yMin as 560 and yMax as 800

then my graph shows 2 zero's at both the places on top that was my line will drawn in between however if i remove those 2 zero's and have data as [689, 699, 700] then my line starts touching yaxis which is kind of overlaping line lable with yaxis so i need to stat the line little away from yaxis bar in other works i need to stat the line from 2nd or 3rd xaxis value how is this possible any examples would appreciate

Thanks,
Ananth
Posted by Richard on 26th September 2017
Hi there,

Like this:

www.rgraph.net/fiddle/view.html/new-rgraph-line-chart-minimum-example

If you want, you can take out the for loop that changes zeros to the minimum value - though then you just breaks in the line instead - so it's your choice.


Richard
Posted by Ananth on 26th September 2017
Hi Richard,

thank you! i will try this and get back to you one more question its on different heading regarding titleXaxis and titleYaxis both of these properties is not working whete i could see the span as display none

<span id="150_130_asdcvs" style="position: absolute; display: none; left: 178px; top: 158.867px; color: rgb(0, 0, 0); font-family: &quot;Segoe UI&quot;; font-weight: bold; font-style: normal; font-size: 12pt; white-space: nowrap; pointer-events: auto; text-align: center;">asd</span>

var lineTicketTrendProductionSustain = new RGraph.Line({
                 id: 'cvsOverallTicketTrend',
                 data: objData,
                 options: {
                     gutterBottom: 45,
                     labels: ['', 'Apr', 'May', 'Jun', ''],
                     colors: ['#7CB5EC'],
                     tickmarks: 'filledsquare',
                     shadow: false,
                     labelsAbove: true,
                     labelsAboveBorder: false,
                     linewidth: 2,
                     ymin: objyMin,
                     ymax: objyMax,
                     title: 'XYZ',
                     titleXaxis: 'abc xaxis',
                     titleYaxis: 'abc yAxis',
                     titleXaxisColor: 'black',
                     backgroundColor: '#e5f3ff',
                     backgroundGrid: true,
                     backgroundGridColor: '#fff',
                     backgroundGridVlines: false,
                     backgroundGridBorder: false,
                     hmargin: 5,
                     scaleZerostart: true,
                     axisColor: '#000000',
                     numxticks: 0,
                     noyaxis: false,
                     textFont: 'Segoe UI',
                     textSize: 10,
                     textColor: '#000000',
                     textAccessible: true
                 }
             }).trace2();
Posted by Ananth on 26th September 2017
Hi Richard,

thank you! but i was looking for xmin and xmax i sont want the starting point on this graph from (0,0) it should start from 689 so line should have 3 points in this case start at middled of the graph from 689 and then to 699 and then to 700 and should not draw an intersection back to zero in XAxis

Thanks,
Ananth
Posted by Ananth on 27th September 2017
Hi Richard,

thank you! but i was looking for xmin and xmax i dont want the starting point on this graph from (0,0) it should start from 689 so line should have 3 points in this case start at middled of the graph from 689 and then to 699 and then to 700 and should not draw an intersection back to zero in XAxis

Thanks,
Ananth
Posted by Richard on 27th September 2017
Hi there,

> one more question its on different heading regarding titleXaxis and titleYaxis both of
> these properties is not working whete i could see the span as display none

The label may be inheriting from your own CSS. You could try adding this just above the canvas tag:

<style>
     div.rgraph_domtext_wrapper span {
         display: inline;
     }
</style>

Richard
Posted by Richard on 27th September 2017
Hi there,

If you don't want to have the line drawn to the axis - instead of zero use null, eg:

var myData = [null, 689, 699, 700, null];

So take this out:

> for (var i=0; i<myData.length; ++i) {
> if (myData[i] < ymin) {
> myData[i] = ymin;
> }
>}


Richard
Posted by Ananth on 27th September 2017
Hi Richard,

apologize for the multiple post and confusions,

1. i will check this and get back to you for that Line chart
2. regarding the CSS part i will try this out and get back to you!

Thanks
Ananth
Posted by Richard on 27th September 2017
Hi there,

2. Actually it may need to use the !important modifier like this:

<style>
      div.rgraph_domtext_wrapper span {
          display: inline !important;
      }
</style>


Richard
Posted by Ananth on 28th September 2017
Hi Richard,

both are working fine thanks for your help

Thanks
Ananth

Add a reply




« Back to message list