F2Axis

2 min read

F2Axis

Axes configuration. The composition of the coordinate axes of F2Native is as follows:

TerminologyEnglish
Axis textlabel
Coordinate axisline
Axis gridlinesgrid

API

- Axis

Set the coordinate axis configuration; the coordinate axis composition of F2Native is as follows

iOS

 chart.axis(@"date", @{ @"grid": @(NO) });
 chart.axis(@"value", @{
              @"line": @(NO),
              @"grid": @{
                @"type": @"dash",
                @"lineWidth": @(1.0f),
                @"stroke": @"#E6E6E6",
                @"lineDash": @[@(6),@(3)]
               },
              @"label": @{ @"textColor": @"#cccccc" ,@"textAlign":@"end",@"labelOffset":@(5)}
            });

Android

chart.setAxis("sales", new F2Chart.AxisConfigBuilder()
      .label(new F2Chart.AxisLabelConfigBuilder().labelOffset(5))
      .grid(new F2Chart.AxisGridConfigBuilder().type("dash"))
      .line(new F2Chart.AxisLineConfigBuilder().lineWidth(1).color("#E6E6E6").type("dash").lineDash(new double[]{6, 3}));
  • parameters
Attribute NameTypeExplanation
fieldStringThe name of the data represented by the current axis in source
configDictionaryFor the specific configuration information of the coordinate axis, see below config

-config

Attribute NameTypeExplanation
lineBool/Dictionaryfalse - axis hidden
configuration see line definition below
gridBool/Dictionaryfalse - axis grid lines are hidden
configuration see grid definition below
labelBool/Dictionaryfalse - axis gridlines are hidden
configuration see label definition below
  • line
Property NameTypeExplanationDefault Value
typeStringline type"line"/"dash"
colorStringline color (Hex rgba)"#999"
lineWidthfloatline width1.0f
  • grid
Property NameTypeExplanationDefault Value
typeStringgrid line type
line- line
dash- dashed line
"line"
strokeStringgrid line color (Hex rgba)"#999"
lineWidthfloatgrid line width1.0f
lineDashArray<Number>dash style[2, 2]
  • label
Property NameTypeExplanationDefault Value
textColorStringfont color (Hex rgba)"#999"
textAlignStringAlignment"start"
lineDashArray<Number>dash style[2, 2]