logo
down
shadow

Can I make an area chart which bounds defined between two lines with Google Charts library?


Can I make an area chart which bounds defined between two lines with Google Charts library?

By : Adam Wilson
Date : October 25 2020, 09:10 AM
it should still fix some issue you can use a stacked area chart, with the bottom stack color set to transparent.
see following working snippet,
code :
google.charts.load('current', {
  packages: ['corechart']
}).then(function () {
  var data = google.visualization.arrayToDataTable([
    ['x', 'y'],
    [1, 115],
    [2, 116],
    [3, 117],
    [4, 118],
    [5, 119],
    [6, 125],
    [7, 135],
    [8, 145],
    [9, 142],
    [10, 140],
    [11, 136],
    [12, 128],
    [13, 120],
    [14, 118],
    [15, 117],
    [16, 116],
    [17, 112],
    [18, 110],
    [19, 110],
    [20, 109],
  ]);

  var view = new google.visualization.DataView(data);
  view.setColumns([0, 1, {
    calc: function (dt, row) {
      return dt.getValue(row, 1) - 60;
    },
    type: 'number',
    label: 'bottom'
  }, {
    calc: function (dt, row) {
      return dt.getValue(row, 1);
    },
    type: 'number',
    label: 'top'
  }]);

  var options = {
    colors: ['blue', 'transparent', 'blue'],
    lineWidth: 0,
    height: 400,
    isStacked: true,
    series: {
      0: {
        lineWidth: 1,
        pointSize: 4,
        type: 'line'
      },
      1: {
        enableInteractivity: false,
        visibleInLegend: false
      },
      2: {
        enableInteractivity: false,
        visibleInLegend: false
      }
    }
  };

  var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
  chart.draw(view, options);
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>


Share : facebook icon twitter icon
PNG area chart with Google Charts API?

PNG area chart with Google Charts API?


By : payam-nice
Date : March 29 2020, 07:55 AM
like below fixes the issue I spent a lot of time on this and discovered that I can do this:
See the example visually or the code below:
code :
http://chart.apis.google.com/chart
   ?chxl=1:|week1|week2
   &chxp=1,20,90
   &chxr=0,0,120
   &chxs=0,676767,11.5,0.5,l,676767|1,676767,9.5,0,_,676767
   &chxt=y,x
   &chs=300x278
   &cht=lxy
   &chco=FF9900,FF0000
   &chds=6.667,100,0,110,0,100,0,118.333
   &chd=t:-1|110,80|-1|43,32
   &chdl=Total+Num|Special+Num
   &chdlp=t
   &chg=1,-1,1,0
   &chls=2|2
   &chma=8,0,0,7|54,2
   &chtt=%23+Total+and+%23+Red+Items
   &chts=000000,11.5
   &chm=b,FF9900,0,1,0|B,FF0000,1,9,0
Plot vertical lines with different colors on area chart, google charts

Plot vertical lines with different colors on area chart, google charts


By : Martin Amdisen
Date : March 29 2020, 07:55 AM
should help you out I am trying to plot an area chart which have vertical lines for each date. I want to represent each line with different color. , You need stemColor property of annotations to color those lines.
code :
annotations: {
    stemColor: 'red'
}
Multiple vertical lines with different colors on area chart, google charts. Issue line colors disappears on hovering on

Multiple vertical lines with different colors on area chart, google charts. Issue line colors disappears on hovering on


By : Muruges
Date : March 29 2020, 07:55 AM
Does that help Wee, as far I see it is for you to keep elements painted, and chart API has no idea how have you customized its styles. The only solution I can see here is to keep lines painted by your own, after each time chart API repaints it.
For this purpose you can use
code :
onmouseout
onmouseover
var updateElementColor = function(element){
              var color = element.getAttribute('my-color');
          if(!color){
              color = getRandomColor();
          }
          element.setAttribute('stroke', color);
          element.setAttribute('my-color', color);
          element.setAttribute('stroke-width', '5'); 
};

var updateColorsCallback = function() {
      var rects = document.getElementById('linechart_material')
                  .querySelector('svg')
                  .querySelector('g:nth-of-type(2)')
                  .querySelector('g:nth-of-type(1)')
                  .querySelector('g:nth-of-type(4)')
                  .querySelectorAll('rect')
      for (var i=0;i<rects.length;i++) {
          updateElementColor(rects[i]);
      }         
};
google.visualization.events.addListener(chart, 'ready', 
     updateColorsCallback 
);    
google.visualization.events.addListener(chart, 'onmouseout', 
     updateColorsCallback 
);  
google.visualization.events.addListener(chart, 'onmouseover', 
     updateColorsCallback 
);  
Google Charts chart area out of bounds

Google Charts chart area out of bounds


By : ab c
Date : March 29 2020, 07:55 AM
I hope this helps . It would seem the chart isn't rendered properly on hidden objects. Perhaps there are better ways to handle it directly in the google chart settings, but a solution would be to draw the actual chart when the tab is shown. For example, call the draw once if the tab is clicked:
code :
$('a[title=content_2]').one('click',function(){
    chart2.draw(data, options);
});
Google charts Area chart, How to avoid the color shades in charts?

Google charts Area chart, How to avoid the color shades in charts?


By : Satya
Date : March 29 2020, 07:55 AM
it should still fix some issue [Google Area charts** , add the following chart option...
code :
areaOpacity: 1
Related Posts Related Posts :
  • Integration Testing with Kitchen CI
  • Can't seem to get the from <asp:Literal </asp:Literal> property in Web forms
  • Can't access faraday params on views
  • RQM testNG integration
  • How can I enable unit templates?
  • Displaying multiple colors on a single data bar
  • Loading aggregates on reacting to domain events
  • Integrating Azure Cognitive services with Robotic Process Automation
  • Autodesk Forge Design Automation quota
  • Why can i not login to the wso2 api store using the email address of a secondary user store account
  • order not working with sortWhitelist
  • config.site for vendor libs on Fedora x86_64
  • Getting a limit response from Loopback, when no authentication is provided
  • What is the effect of FeedOptions.EnableLowPrecisionOrderBy Property
  • Recordset Null Value not being detected in null check
  • How to connect to an arbitary database using FaaS?
  • SourceTree not working after Windows 10 Fall Creators Update
  • How to get all registered user from Openfire through http
  • Error "invalid parameter" when launching a converted app
  • Using react-sortable-hoc with react-virtualized Grid
  • Xamarin.Forms: How to set values in Style only on specific platform
  • ZSH avoid adding empty commands to history?
  • Grep regular expression - Pattern issue
  • Unable to connect via Java to a DSE graph
  • Check if attachment is up to date with current document revision in couchdb
  • Can I bind an argument value ahead of time when using redux-actions?
  • How to change a member field with Kotlin reflection?
  • Replaying merged streams individually
  • DevExpress GridColumn strange proportional sizing
  • Drools Decision table error : Error while creating KieBase
  • Kafka-Flink-Stream processing: Is there a way to reload input files into the variables being used in a streaming process
  • How to export and import nifi flow from one HDP to another HDP
  • map pointWidth to a single Datapoint in Column Chart
  • Pygame animating image by transforming it
  • Why is my Gdk/cairo class causing a segfault?
  • How to organize queues in Masstransit/RabbitMQ?
  • How to remove a collection element without EntityManager#remove(...) in Doctrine 2?
  • how to change the format of the return value of 'mnist.load_data()' to 'mnist_train.csv' in Keras?
  • CodeFights Interview Practice- Dynamic Programing : Basic : fillingBlocks
  • Accessing the built request details in Karate
  • How to draw a polyline with initial point in Leaflet
  • docusign transform pdf field with text tab as required
  • How to avoid "unused variable in a for loop" error
  • Clipping a polygon to only draw within a circle in Love2D
  • Can't import library in Python
  • Silverstripe - Turn modules on or off in config
  • How does shared memory work behind the scene in Linux?
  • Vue - how to bind table column to a data object?
  • OrientDB deep traversal until specific class
  • Static code analysis of Dockerfiles?
  • Is Batmobile Defy Mini a fake device?
  • Reverse a list to a range
  • Add multiple y-axis to SAPUI5 VizFrame Column Charts
  • Nightmare with rabbitmq.client versions
  • How to change timeout for a request in okhttp
  • How to support relative date parameters in Web Intelligence Report
  • cfEngine3 - class if package is installed
  • Count number of sentences in a string in SAS
  • Visit Last Loaded URL
  • What are the use cases to substitute cookbook array attribute in chef?
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org