角度图表js类型线设置图表 - 选项不起作用

时间:2017-06-20 11:56:22

标签: angularjs chart.js angular-chart

您好我试图将图表配置为没有任何工具提示或图例,并且看起来像所有已配置的选项都被忽略。我做错了什么?

它是js对象:

$scope.options = {
    segmentShowStroke : false,
     elements: { arc: { borderWidth: 0 } ,  point: {
          radius: 0
        }},
     tooltips:{
            enabled:false
        },
    legend: {
             display: false
        },
    scales: {
      yAxes: [
        {
          id: 'y-axis-1',
          type: 'linear',
          display: false,
          position: 'left'
        }

      ]
    }
  };

它是画布元素:

<canvas id="line" class="chart chart-line"
chart-data="data" chart-labels="labels" chart-options="options"
chart-dataset-override="datasetOverride"
chart-click="onClick" height="40px" width="1000px"
chart-colors="graph.colors" style=" width: 1000px; ;max-height: 40px !important;">
</canvas>

2 个答案:

答案 0 :(得分:0)

试试这个解决方案

options : {
    scales : {
        xAxes : [ {
            gridLines : {
                display : false
            }
        } ]
    }
}

答案 1 :(得分:0)

我设法让它工作,只有在改变了像chartjsProvider.setOptions这样的选项之后

structure(list(year = c(2015, 2014, 2013, 2012, 2011, 2010, 2009, 
2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 
1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 
1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 
1975, 1974, 1973, 1972, 1971, 1970, 1969, 1968, 1967, 1966, 1965, 
1964, 1963, 1962, 1961, 1960, 2016, 2015, 2014, 2012, 2003, 1991, 
1987, 1977, 1975, 1968, 1965, 2016, 2015, 2013, 2012, 2011, 2010, 
2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 
1998, 1997, 1996, 1995, 1994, 1991, 1990, 1988, 1986, 1985, 1983, 
1982, 1980, 1978, 1975, 1973, 1968, 2016, 2015, 2014, 2013, 2012, 
2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 
2000, 1999, 1998, 1997, 1995, 1994, 1993, 1992, 1991, 1990, 1987, 
1986, 1985, 1984, 1983, 1981, 1973, 1972, 1971, 1970, 1969, 1968, 
1967, 1964, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 
2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1996, 
1995, 1994, 1993, 1992, 1991, 1990, 1987, 1986, 1985, 1983, 1980, 
1979, 1978, 1976, 1973, 1972, 1971, 1967, 1965, 1962, 2016, 2015, 
2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 
2001, 2000, 1999, 1998, 1997, 1996, 1995, 1991, 1988, 1986, 1983, 
1982, 1980, 1978, 1975, 1973, 1968, 2016, 2015, 2014, 2013, 2012, 
2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2000, 
1999, 1998, 1997, 1996, 1995, 1991, 1990, 1983, 1979, 1976, 2016, 
2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 
2004, 2002, 2001, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 
1991, 1990, 1988, 1986, 1983, 1982, 1980, 1978, 1975, 1973, 1968, 
2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2006, 2005, 
2004, 2003, 2001, 2000, 1999, 1998, 1996, 1995, 1994, 1988, 1986, 
1985, 1984, 1983, 1975, 1973, 1968, 2016, 2015, 2014, 2012, 2011, 
2010, 2009, 2008, 2006, 2005, 2004, 2002, 2001, 2000, 1998, 1997, 
1996, 1995, 1994, 1991, 1988, 1986, 1983, 1982, 1978, 1977, 1975, 
1973, 1968, 2016, 2015, 2014, 2012, 2009, 2004, 2003, 2002, 2001, 
1999, 1998, 1997, 1995, 1993, 1992, 1987, 1985, 1979, 1965, 1964, 
2015, 2014, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 
2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1992, 
1991, 1990, 1988, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 
1978, 1976, 1975, 1974, 1973, 1968, 1967, 1963, 1961, 2016, 2015, 
2012, 2009, 2004, 2002, 2001, 1999, 1998, 1993, 1992, 1990, 1987, 
1985, 1979, 1965, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 
2006, 2005, 2004, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 
1991, 1988, 1986, 1985, 1984, 1983, 1976, 1975, 1973, 1968, 1961, 
2016, 2015, 2014, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 
2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 
1993, 1992, 1991, 1990, 1989, 1988, 1986, 1983, 1982, 1980, 1979, 
1977, 1976, 1975, 1973, 1968, 1961, 2016, 2015, 2014, 2012, 2011, 
2010, 2009, 2008, 2006, 2005, 2004, 2001, 2000, 1998, 1996, 1995, 
1994, 1988, 1986, 1983, 1978, 1975, 1973, 1968, 2016, 2015, 2014, 
2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 
2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 
1991, 1990, 1989, 1988, 1987, 1986, 1985, 1983, 1981, 1980, 1979, 
1978, 1973, 1972, 1970, 1969, 1968, 1967, 2016, 2015, 2014, 2013, 
2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2002, 2000, 
1999, 1998, 1997, 1996, 1995, 1994, 1991, 1989, 1988, 1986, 1983, 
1982, 1978, 1976, 1975, 1973, 1969, 1968, 1967, 2016, 2015, 2014, 
2012, 2011, 2010, 2009, 2008, 2006, 2005, 2002, 2001, 2000, 1999, 
1998, 1997, 1996, 1995, 1994, 1992, 1991, 1990, 1988, 1986, 1984, 
1983, 1975, 1973, 1968, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 
2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2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7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 
14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 
15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 
16L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 
17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 
19L, 19L, 19L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L), .Label = 
c("ALL", "AB", "BB", "BS", "CS", "DS", "EG", "FB", "GB", "KB", "KS", "LS", 
"LP", "MC", "NB", "NW", "SB", "SH", "VM", "WH"), class = "factor"), 
count = c(28, 36, 38, 22, 21, 24, 20, 36, 15, 14, 21, 12, 
16, 12, 11, 12, 15, 14, 8, 10, 3, 7, 4, 5, 10, 7, 7, 6, 5, 
15, 11, 4, 3, 6, 9, 8, 9, 5, 5, 9, 8, 6, 5, 5, 5, 7, 6, 6, 
8, 3, 4, 1, 3, 1, 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