The text!
function is just a convenience around the Title
type in the same way as the title!
function, so that end-users don’t need to reference ec.title
directly (though, nothing prevents users modifying the EChart
chart instance).
Two methods are provided. If you just want to append a piece of text to the EChart
, you can use the method without specifying a series
. If you want to modify a piece of text in place, specify its series
(such as to change the font without changing the text or other features).
Method Signatures
text! ( ec :: EChart ) #push new text onto EChart
text! ( ec :: EChart , series :: Int ) #modify a piece of text in place
Optional Arguments
show :: Union { Bool , Void } = true
text :: Union { String , Void } = nothing
link :: Union { String , Void } = nothing
target :: Union { String , Void } = "blank"
textStyle :: Union { TextStyle , Void } = nothing
textAlign :: Union { String , Void } = nothing
textBaseline :: Union { String , Void } = nothing
subtext :: Union { String , Void } = nothing
sublink :: Union { String , Void } = nothing
subtarget :: Union { String , Void } = "blank"
subtextStyle :: Union { TextStyle , Void } = nothing
padding :: Union { Array { Int , 1 }, Int , Void } = 5
itemGap :: Union { Int , Void } = 5
zlevel :: Union { Int , Void } = 0
z :: Union { Int , Void } = 2
left :: Union { Int , String , Void } = "left"
top :: Union { Int , String , Void } = "auto"
right :: Union { Int , String , Void } = "auto"
bottom :: Union { Int , String , Void } = "auto"
backgroundColor :: Union { String , Void , JSFunction } = nothing
borderColor :: Union { String , Void } = "transparent"
borderWidth :: Union { Int , Void } = 1
shadowBlur :: Union { Int , Void } = nothing
shadowColor :: Union { String , Void } = nothing
shadowOffsetX :: Union { Int , Void } = 0
shadowOffsetY :: Union { Int , Void } = 0
Examples
Add text to a chart
using ECharts , RDatasets
df = dataset ( "datasets" , "mtcars" )
sgrp = scatter ( df , : MPG , : HP , : Cyl )
title! ( sgrp , text = "Horsepower vs. Miles Per Gallon" )
text! ( sgrp , subtext = "Source: mtcars dataset from R" , left = "0%" , bottom = "0%" )
Modify text in place - Add HTML link
text! ( sgrp , 2 , sublink = "https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/mtcars.html" )