Google Combo Charts?

前端 未结 1 1854
青春惊慌失措
青春惊慌失措 2021-01-12 14:40

\"enter

I have 4 entities and I show them for 4 days. But first and last days I cant s

1条回答
  •  鱼传尺愫
    2021-01-12 15:20

    I recently had to build a chart like this. Please consider my code for your solution:

    Put this in your Controller:

    
    Function WeightAreaChartData() As JsonResult
    
        Dim myData = db.Tbl_Weights.Where(Function(x) x.Weight_Employee_ID).OrderBy(Function(x) x.Weight_Create_Date)
    
        Dim data = New List(Of Object)
    
        data.Add(New Object() {"Date", "Your Weight"})
    
        For Each i As Tbl_Weight In myData
    
            data.Add(New Object() {DateTime.Parse(i.Weight_Create_Date).Day, i.Weight_Amount})
    
        Next
    
        Return Json(data, JsonRequestBehavior.AllowGet)
    
    End Function
    

    Put this in your view; changing the $.post() URL accordingly:

    
    
    

    To fix your specific issue of the bars being cut off, I believe you can use this in your options:

    hAxis: {
      viewWindowMode: 'pretty'
    }
    

    Like this:

    var options = {
                            title: 'Weight Lost & Gained This Month',
                            hAxis: { title: 'Day of Month', titleTextStyle: { color: '#1E4A08'} },
                            vAxis: { title: 'Lbs.', titleTextStyle: { color: '#1E4A08' } },
                            chartArea: { left: 50, top: 30, width: "75%" },
                            colors: ['#FF8100', 'blue'],
                           hAxis: {
    
                                viewWindowMode: 'pretty'
                              }
                        };
    

    0 讨论(0)
提交回复
热议问题