Documentation ¶
Index ¶
- type BarChart
- func (chart *BarChart) AddDataPoint(values []float64, label string, index int)
- func (chart *BarChart) AddDataSelectListener(fn eventListenerCallback)
- func (chart *BarChart) AddEventListener(eventName string, fn eventListenerCallback)
- func (chart *BarChart) AppendDataPoint(values []float64, label string)
- func (chart *BarChart) HideAverages()
- func (chart *BarChart) HideSums()
- func (chart *BarChart) PopDataPoint()
- func (chart *BarChart) RemoveDataPoint(index int)
- func (chart *BarChart) ShowAverages()
- func (chart *BarChart) ShowSums()
- func (chart *BarChart) UpdateValues(updateValues *UpdateValuesArgs)
- type BarChartArgs
- func (chartArgs *BarChartArgs) Render() *BarChart
- func (chartArgs *BarChartArgs) SetBton(key string, val bool)
- func (chartArgs *BarChartArgs) SetIsNavigable(val bool) *BarChartArgs
- func (chartArgs *BarChartArgs) SetIsSeries(val bool) *BarChartArgs
- func (chartArgs *BarChartArgs) SetXAxisMode(mode string) *BarChartArgs
- func (chartArgs *BarChartArgs) SetYAxisMode(mode string) *BarChartArgs
- func (chartArgs *BarChartArgs) WithColors(colors []string) *BarChartArgs
- func (chartArgs *BarChartArgs) WithFormatTooltipX(callback func(string) string) *BarChartArgs
- func (chartArgs *BarChartArgs) WithFormatTooltipY(callback func(string) string) *BarChartArgs
- func (chartArgs *BarChartArgs) WithHeight(height int) *BarChartArgs
- func (chartArgs *BarChartArgs) WithTitle(title string) *BarChartArgs
- type ChartData
- type DataSelectEvent
- type Dataset
- type HeatmapArgs
- type LineChart
- func (chart *LineChart) AddDataPoint(values []float64, label string, index int)
- func (chart *LineChart) AppendDataPoint(values []float64, label string)
- func (chart *LineChart) HideAverages()
- func (chart *LineChart) PopDataPoint()
- func (chart *LineChart) RemoveDataPoint(index int)
- func (chart *LineChart) ShowAverages()
- func (chart *LineChart) UpdateValues(updateValues *UpdateValuesArgs)
- type LineChartArgs
- func (chartArgs *LineChartArgs) Render() *LineChart
- func (chartArgs *LineChartArgs) SetBton(key string, val bool)
- func (chartArgs *LineChartArgs) SetHeatline(val bool) *LineChartArgs
- func (chartArgs *LineChartArgs) SetIsSeries(val bool) *LineChartArgs
- func (chartArgs *LineChartArgs) SetRegionFill(val bool) *LineChartArgs
- func (chartArgs *LineChartArgs) SetShowDots(val bool) *LineChartArgs
- func (chartArgs *LineChartArgs) SetXAxisMode(mode string) *LineChartArgs
- func (chartArgs *LineChartArgs) SetYAxisMode(mode string) *LineChartArgs
- func (chartArgs *LineChartArgs) WithColors(colors []string) *LineChartArgs
- func (chartArgs *LineChartArgs) WithFormatTooltipX(callback func(string) string) *LineChartArgs
- func (chartArgs *LineChartArgs) WithFormatTooltipY(callback func(string) string) *LineChartArgs
- func (chartArgs *LineChartArgs) WithHeight(height int) *LineChartArgs
- func (chartArgs *LineChartArgs) WithTitle(title string) *LineChartArgs
- type PercentageChartArgs
- type PieChartArgs
- type ScatterChart
- func (chart *ScatterChart) AddDataPoint(values []float64, label string, index int)
- func (chart *ScatterChart) AppendDataPoint(values []float64, label string)
- func (chart *ScatterChart) HideAverages()
- func (chart *ScatterChart) PopDataPoint()
- func (chart *ScatterChart) RemoveDataPoint(index int)
- func (chart *ScatterChart) ShowAverages()
- func (chart *ScatterChart) UpdateValues(updateValues *UpdateValuesArgs)
- type ScatterChartArgs
- func (chartArgs *ScatterChartArgs) Render() *ScatterChart
- func (chartArgs *ScatterChartArgs) SetBton(key string, val bool)
- func (chartArgs *ScatterChartArgs) SetIsSeries(val bool) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) SetXAxisMode(mode string) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) SetYAxisMode(mode string) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) WithColors(colors []string) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) WithFormatTooltipX(callback func(string) string) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) WithFormatTooltipY(callback func(string) string) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) WithHeight(height int) *ScatterChartArgs
- func (chartArgs *ScatterChartArgs) WithTitle(title string) *ScatterChartArgs
- type SpecificValue
- type UpdateValueSet
- type UpdateValuesArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BarChart ¶
func (*BarChart) AddDataPoint ¶
func (*BarChart) AddDataSelectListener ¶
func (chart *BarChart) AddDataSelectListener(fn eventListenerCallback)
AddDataSelectListener is a helper function to allow users to quickly set a data-select event. This allows users to access the index, value, and label of any particular data point!
func (*BarChart) AddEventListener ¶
func (*BarChart) AppendDataPoint ¶
func (*BarChart) HideAverages ¶
func (chart *BarChart) HideAverages()
func (*BarChart) PopDataPoint ¶
func (chart *BarChart) PopDataPoint()
func (*BarChart) RemoveDataPoint ¶
func (*BarChart) ShowAverages ¶
func (chart *BarChart) ShowAverages()
func (*BarChart) UpdateValues ¶
func (chart *BarChart) UpdateValues(updateValues *UpdateValuesArgs)
type BarChartArgs ¶
type BarChartArgs struct { *js.Object Parent string `js:"parent"` Title string `js:"title"` Data *ChartData `js:"data"` Type string `js:"type"` Height int `js:"height"` Colors []string `js:"colors"` XAxisMode string `js:"x_axis_mode"` YAxisMode string `js:"y_axis_mode"` IsSeries int `js:"is_series"` FormatTooltipX func(string) string `js:"format_tooltip_x"` FormatTooltipY func(string) string `js:"format_tooltip_y"` }
func NewBarChart ¶
func NewBarChart(parent string, data *ChartData) *BarChartArgs
func (*BarChartArgs) Render ¶
func (chartArgs *BarChartArgs) Render() *BarChart
func (*BarChartArgs) SetBton ¶
func (chartArgs *BarChartArgs) SetBton(key string, val bool)
func (*BarChartArgs) SetIsNavigable ¶
func (chartArgs *BarChartArgs) SetIsNavigable(val bool) *BarChartArgs
func (*BarChartArgs) SetIsSeries ¶
func (chartArgs *BarChartArgs) SetIsSeries(val bool) *BarChartArgs
func (*BarChartArgs) SetXAxisMode ¶
func (chartArgs *BarChartArgs) SetXAxisMode(mode string) *BarChartArgs
func (*BarChartArgs) SetYAxisMode ¶
func (chartArgs *BarChartArgs) SetYAxisMode(mode string) *BarChartArgs
func (*BarChartArgs) WithColors ¶
func (chartArgs *BarChartArgs) WithColors(colors []string) *BarChartArgs
func (*BarChartArgs) WithFormatTooltipX ¶
func (chartArgs *BarChartArgs) WithFormatTooltipX(callback func(string) string) *BarChartArgs
func (*BarChartArgs) WithFormatTooltipY ¶
func (chartArgs *BarChartArgs) WithFormatTooltipY(callback func(string) string) *BarChartArgs
func (*BarChartArgs) WithHeight ¶
func (chartArgs *BarChartArgs) WithHeight(height int) *BarChartArgs
func (*BarChartArgs) WithTitle ¶
func (chartArgs *BarChartArgs) WithTitle(title string) *BarChartArgs
type ChartData ¶
type ChartData struct { *js.Object Labels []string `js:"labels"` Datasets []*Dataset `js:"datasets"` SpecificValues []*SpecificValue `js:"specific_values"` }
ChartData represents the "data" object that is passed into any of the charts except Heatmap. https://frappe.github.io/charts/ Ctrl + F "let data ="
func NewChartData ¶
func NewChartData() *ChartData
NewChartData just instantiates a ChartData JS object.
type DataSelectEvent ¶
type Dataset ¶
Dataset represents a single dataset of the JS object 'data'. https://frappe.github.io/charts/ Ctrl + F "datasets". Wrap this inside a dataset array.
func NewDataset ¶
NewDataset allows us to quickly create Dataset objects with the required values.
type HeatmapArgs ¶
type HeatmapArgs struct { *js.Object Parent string `js:"parent"` Data map[string]interface{} `js:"data"` Type string `js:"type"` Height int `js:"height"` DiscreteDomains int `js:"discrete_domains"` Start *js.Object `js:"start"` // TODO LegendColors []string `js:"legend_colors"` }
func NewHeatmapChart ¶
func NewHeatmapChart(parent string, data map[string]int) *HeatmapArgs
func (*HeatmapArgs) Render ¶
func (chartArgs *HeatmapArgs) Render()
func (*HeatmapArgs) SetDiscreteDomain ¶
func (chartArgs *HeatmapArgs) SetDiscreteDomain(val bool) *HeatmapArgs
func (*HeatmapArgs) WithHeight ¶
func (chartArgs *HeatmapArgs) WithHeight(height int) *HeatmapArgs
func (*HeatmapArgs) WithLegendColors ¶
func (chartArgs *HeatmapArgs) WithLegendColors(colors []string) *HeatmapArgs
type LineChart ¶
func (*LineChart) AddDataPoint ¶
AddDataPoint allows us to add a data point to anywhere in the chart.
func (*LineChart) AppendDataPoint ¶
AppendDataPoint calls add_data_point without an index (which defaults to the end).
func (*LineChart) HideAverages ¶
func (chart *LineChart) HideAverages()
HideAverages simply hides the averages displayed using ShowAverages.
func (*LineChart) PopDataPoint ¶
func (chart *LineChart) PopDataPoint()
PopDataPoint calls remove_data_point without arguments, which defaults to removing the element at index 0.
func (*LineChart) RemoveDataPoint ¶
RemoveDataPoint allows users to remove a data point anywhere in the array.
func (*LineChart) ShowAverages ¶
func (chart *LineChart) ShowAverages()
ShowAverages calls show_averages which makes a new horizontal line representing the average for every dataset.
func (*LineChart) UpdateValues ¶
func (chart *LineChart) UpdateValues(updateValues *UpdateValuesArgs)
UpdateValues allows us to batch update the values of the chart. Make sure to pass in the original labels if you want to keep the structure of your chart. This should be improved.
type LineChartArgs ¶
type LineChartArgs struct { *js.Object Parent string `js:"parent"` Title string `js:"title"` Data *ChartData `js:"data"` Type string `js:"type"` Height int `js:"height"` Colors []string `js:"colors"` XAxisMode string `js:"x_axis_mode"` YAxisMode string `js:"y_axis_mode"` IsSeries int `js:"is_series"` ShowDots int `js:"show_dots"` Heatline int `js:"heatline"` RegionFill int `js:"region_fill"` FormatTooltipX func(string) string `js:"format_tooltip_x"` FormatTooltipY func(string) string `js:"format_tooltip_y"` }
LineChartArgs represents the configuration arguments that can be used to instantiate a line chart.
func NewLineChart ¶
func NewLineChart(parent string, data *ChartData) *LineChartArgs
func (*LineChartArgs) Render ¶
func (chartArgs *LineChartArgs) Render() *LineChart
Render returns a LineChart that allows users to call the above functions.
func (*LineChartArgs) SetBton ¶
func (chartArgs *LineChartArgs) SetBton(key string, val bool)
func (*LineChartArgs) SetHeatline ¶
func (chartArgs *LineChartArgs) SetHeatline(val bool) *LineChartArgs
SetHeatline allows us to set heatline using a boolean instead of 1/0's.
func (*LineChartArgs) SetIsSeries ¶
func (chartArgs *LineChartArgs) SetIsSeries(val bool) *LineChartArgs
SetIsSeries allows us to set is_series using a boolean instead of 1/0's.
func (*LineChartArgs) SetRegionFill ¶
func (chartArgs *LineChartArgs) SetRegionFill(val bool) *LineChartArgs
SetRegionFill allows us to set region_fill using a boolean instead of 1/0's.
func (*LineChartArgs) SetShowDots ¶
func (chartArgs *LineChartArgs) SetShowDots(val bool) *LineChartArgs
SetShowDots allows us to set show_dots using a boolean instead of 1/0's.
func (*LineChartArgs) SetXAxisMode ¶
func (chartArgs *LineChartArgs) SetXAxisMode(mode string) *LineChartArgs
func (*LineChartArgs) SetYAxisMode ¶
func (chartArgs *LineChartArgs) SetYAxisMode(mode string) *LineChartArgs
func (*LineChartArgs) WithColors ¶
func (chartArgs *LineChartArgs) WithColors(colors []string) *LineChartArgs
func (*LineChartArgs) WithFormatTooltipX ¶
func (chartArgs *LineChartArgs) WithFormatTooltipX(callback func(string) string) *LineChartArgs
func (*LineChartArgs) WithFormatTooltipY ¶
func (chartArgs *LineChartArgs) WithFormatTooltipY(callback func(string) string) *LineChartArgs
func (*LineChartArgs) WithHeight ¶
func (chartArgs *LineChartArgs) WithHeight(height int) *LineChartArgs
func (*LineChartArgs) WithTitle ¶
func (chartArgs *LineChartArgs) WithTitle(title string) *LineChartArgs
type PercentageChartArgs ¶
type PercentageChartArgs struct { *js.Object Parent string `js:"parent"` Title string `js:"title"` Data *ChartData `js:"data"` Type string `js:"type"` Height int `js:"height"` Colors []string `js:"colors"` }
PercentageChartArgs represents the args needed to instantiate a percentage chart. PercentageChart does not have as many configuration arguments as other charts in frappe-charts.
func NewPercentageChart ¶
func NewPercentageChart(parent string, data *ChartData) *PercentageChartArgs
func (*PercentageChartArgs) Render ¶
func (chartArgs *PercentageChartArgs) Render()
Render simply renders a percentage chart without returning anything, because percentage charts don't seem to have any methods yet (in 0.0.3 frappe-charts).
func (*PercentageChartArgs) WithColors ¶
func (chartArgs *PercentageChartArgs) WithColors(colors []string) *PercentageChartArgs
func (*PercentageChartArgs) WithHeight ¶
func (chartArgs *PercentageChartArgs) WithHeight(height int) *PercentageChartArgs
func (*PercentageChartArgs) WithTitle ¶
func (chartArgs *PercentageChartArgs) WithTitle(title string) *PercentageChartArgs
type PieChartArgs ¶
type PieChartArgs struct { *js.Object Parent string `js:"parent"` Title string `js:"title"` Data *ChartData `js:"data"` Type string `js:"type"` Height int `js:"height"` Colors []string `js:"colors"` }
PieChartArgs represents the args needed to instantiate a pie chart. PieChart does not have as many configuration arguments as other charts in frappe-charts.
func NewPieChart ¶
func NewPieChart(parent string, data *ChartData) *PieChartArgs
func (*PieChartArgs) Render ¶
func (chartArgs *PieChartArgs) Render()
Render simply renders a pie chart without returning anything, because pie charts don't seem to have any methods yet (in 0.0.3 frappe-charts).
func (*PieChartArgs) WithColors ¶
func (chartArgs *PieChartArgs) WithColors(colors []string) *PieChartArgs
func (*PieChartArgs) WithHeight ¶
func (chartArgs *PieChartArgs) WithHeight(height int) *PieChartArgs
func (*PieChartArgs) WithTitle ¶
func (chartArgs *PieChartArgs) WithTitle(title string) *PieChartArgs
type ScatterChart ¶
func (*ScatterChart) AddDataPoint ¶
func (chart *ScatterChart) AddDataPoint(values []float64, label string, index int)
func (*ScatterChart) AppendDataPoint ¶
func (chart *ScatterChart) AppendDataPoint(values []float64, label string)
func (*ScatterChart) HideAverages ¶
func (chart *ScatterChart) HideAverages()
HideAverages simply hides the averages displayed using ShowAverages.
func (*ScatterChart) PopDataPoint ¶
func (chart *ScatterChart) PopDataPoint()
PopDataPoint calls remove_data_point without arguments, which defaults to removing the element at index 0.
func (*ScatterChart) RemoveDataPoint ¶
func (chart *ScatterChart) RemoveDataPoint(index int)
RemoveDataPoint allows users to remove a data point anywhere in the array.
func (*ScatterChart) ShowAverages ¶
func (chart *ScatterChart) ShowAverages()
ShowAverages calls show_averages which makes a new horizontal line representing the average for every dataset.
func (*ScatterChart) UpdateValues ¶
func (chart *ScatterChart) UpdateValues(updateValues *UpdateValuesArgs)
type ScatterChartArgs ¶
type ScatterChartArgs struct { *js.Object Parent string `js:"parent"` Title string `js:"title"` Data *ChartData `js:"data"` Type string `js:"type"` Height int `js:"height"` Colors []string `js:"colors"` XAxisMode string `js:"x_axis_mode"` YAxisMode string `js:"y_axis_mode"` IsSeries int `js:"is_series"` FormatTooltipX func(string) string `js:"format_tooltip_x"` FormatTooltipY func(string) string `js:"format_tooltip_y"` }
ScatterChartArgs represents the relevant arguments that are used to instantiate a scatter chart.
func NewScatterChart ¶
func NewScatterChart(parent string, data *ChartData) *ScatterChartArgs
func (*ScatterChartArgs) Render ¶
func (chartArgs *ScatterChartArgs) Render() *ScatterChart
Render returns a ScatterChart that allows users to call the above functions.
func (*ScatterChartArgs) SetBton ¶
func (chartArgs *ScatterChartArgs) SetBton(key string, val bool)
func (*ScatterChartArgs) SetIsSeries ¶
func (chartArgs *ScatterChartArgs) SetIsSeries(val bool) *ScatterChartArgs
SetIsSeries allows us to set is_series using a boolean instead of 1/0's.
func (*ScatterChartArgs) SetXAxisMode ¶
func (chartArgs *ScatterChartArgs) SetXAxisMode(mode string) *ScatterChartArgs
func (*ScatterChartArgs) SetYAxisMode ¶
func (chartArgs *ScatterChartArgs) SetYAxisMode(mode string) *ScatterChartArgs
func (*ScatterChartArgs) WithColors ¶
func (chartArgs *ScatterChartArgs) WithColors(colors []string) *ScatterChartArgs
func (*ScatterChartArgs) WithFormatTooltipX ¶
func (chartArgs *ScatterChartArgs) WithFormatTooltipX(callback func(string) string) *ScatterChartArgs
func (*ScatterChartArgs) WithFormatTooltipY ¶
func (chartArgs *ScatterChartArgs) WithFormatTooltipY(callback func(string) string) *ScatterChartArgs
func (*ScatterChartArgs) WithHeight ¶
func (chartArgs *ScatterChartArgs) WithHeight(height int) *ScatterChartArgs
func (*ScatterChartArgs) WithTitle ¶
func (chartArgs *ScatterChartArgs) WithTitle(title string) *ScatterChartArgs
type SpecificValue ¶
type SpecificValue struct { *js.Object Title string `js:"title"` LineType string `js:"line_type"` Value float64 `js:"value"` }
SpecificValue represents a frappe-chart specific value object. https://frappe.github.io/charts/ Ctrl + F "specific_values"
func NewSpecificValue ¶
func NewSpecificValue(title string, lineType string, value float64) *SpecificValue
NewSpecificValue is a helper to create a Specific Value JS object.
type UpdateValueSet ¶
UpdateValueSet represents the JS object frappe-chart uses as parameters for chart.update_values(values, labels). e.g. { values: [1, 2, 3, 4] }
func NewUpdateValueSet ¶
func NewUpdateValueSet(values []float64) *UpdateValueSet
NewUpdateValueSet is a helper to conveniently create an UpdateValueSet.
type UpdateValuesArgs ¶
type UpdateValuesArgs struct { Values []*UpdateValueSet Labels []string }
UpdateValuesArgs is a wrapper that contains the two parameters that chart.update_values(values, labels) requires. https://frappe.github.io/charts/ Ctrl + F "update_values"